From 28eebb4db1f6c5f343f80860760f91e8ba50fe97 Mon Sep 17 00:00:00 2001 From: Stan Verdiesen Date: Tue, 23 Jul 2019 14:34:02 +0200 Subject: [PATCH] Make send timeout configurable in the MqttClient --- M2Mqtt/MqttClient.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/M2Mqtt/MqttClient.cs b/M2Mqtt/MqttClient.cs index 3dff0adc..e377959a 100644 --- a/M2Mqtt/MqttClient.cs +++ b/M2Mqtt/MqttClient.cs @@ -229,6 +229,11 @@ public class MqttClient /// public MqttProtocolVersion ProtocolVersion { get; set; } + /// + /// The send timeout + /// + public int SendTimeout { get; set; } = MqttSettings.MQTT_DEFAULT_TIMEOUT; + #if BROKER /// /// MQTT Client Session @@ -1036,7 +1041,7 @@ private void Send(MqttMsgBase msg) /// MQTT message response private MqttMsgBase SendReceive(byte[] msgBytes) { - return this.SendReceive(msgBytes, MqttSettings.MQTT_DEFAULT_TIMEOUT); + return this.SendReceive(msgBytes, SendTimeout); } /// @@ -1103,7 +1108,7 @@ private MqttMsgBase SendReceive(byte[] msgBytes, int timeout) /// MQTT message response private MqttMsgBase SendReceive(MqttMsgBase msg) { - return this.SendReceive(msg, MqttSettings.MQTT_DEFAULT_TIMEOUT); + return this.SendReceive(msg, SendTimeout); } ///