Skip to content

Commit

Permalink
ISSUE_6 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Samson committed Jun 21, 2017
1 parent 75fe589 commit 8a12270
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion M2Mqtt/MqttClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,16 @@ public byte Connect(string clientId,
// start thread for receiving messages from broker
Fx.StartThread(this.ReceiveThread);

MqttMsgConnack connack = (MqttMsgConnack)this.SendReceive(connect);
MqttMsgConnack connack = null;
try
{
connack = (MqttMsgConnack)this.SendReceive(connect);
}
catch (MqttCommunicationException)
{
this.isRunning = false;
throw;
}

// if connection accepted, start keep alive timer and
if (connack.ReturnCode == MqttMsgConnack.CONN_ACCEPTED)
Expand Down

0 comments on commit 8a12270

Please sign in to comment.