File tree 5 files changed +8
-8
lines changed
5 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 135
135
}
136
136
}
137
137
138
- Console . WriteLine ( "Disconnecting gracefully..." ) ;
138
+ Console . WriteLine ( "Disconnecting gracefully and waiting 5 seconds ..." ) ;
139
139
await client . DisconnectAsync ( ) . ConfigureAwait ( false ) ;
140
+ await Task . Delay ( 5000 ) . ConfigureAwait ( false ) ;
Original file line number Diff line number Diff line change 14
14
15
15
<!-- Update the version to match -->
16
16
<ItemGroup >
17
- <PackageReference Include =" HiveMQtt" Version =" 0.4.0 " />
17
+ <PackageReference Include =" HiveMQtt" Version =" 0.4.1 " />
18
18
</ItemGroup >
19
19
20
20
</Project >
Original file line number Diff line number Diff line change @@ -158,11 +158,11 @@ public async Task<bool> DisconnectAsync(DisconnectOptions? options = null)
158
158
this . OnDisconnectSent -= eventHandler ;
159
159
}
160
160
161
- this . connectState = ConnectState . Disconnected ;
162
-
163
161
// Close the socket
164
162
this . CloseSocket ( ) ;
165
163
164
+ this . connectState = ConnectState . Disconnected ;
165
+
166
166
// Clear the send queue
167
167
this . sendQueue . Clear ( ) ;
168
168
return true ;
Original file line number Diff line number Diff line change @@ -137,8 +137,6 @@ internal async Task<bool> ConnectSocketAsync()
137
137
138
138
internal bool CloseSocket ( bool ? shutdownPipeline = true )
139
139
{
140
- this . cancellationSource . Cancel ( ) ;
141
-
142
140
if ( shutdownPipeline == true )
143
141
{
144
142
// Shutdown the pipeline
@@ -150,6 +148,8 @@ internal bool CloseSocket(bool? shutdownPipeline = true)
150
148
this . socket ? . Shutdown ( SocketShutdown . Both ) ;
151
149
this . socket ? . Close ( ) ;
152
150
151
+ this . cancellationSource . Cancel ( ) ;
152
+
153
153
return true ;
154
154
}
155
155
}
Original file line number Diff line number Diff line change @@ -353,6 +353,7 @@ private Task<bool> TrafficInflowProcessorAsync(CancellationToken cancellationTok
353
353
switch ( this . connectState )
354
354
{
355
355
case ConnectState . Disconnecting :
356
+ case ConnectState . Disconnected :
356
357
// This disconnect was either user or broker initiated.
357
358
// Launch the AfterDisconnect event with a clean disconnect set to true.
358
359
this . AfterDisconnectEventLauncher ( true ) ;
@@ -364,8 +365,6 @@ private Task<bool> TrafficInflowProcessorAsync(CancellationToken cancellationTok
364
365
break ;
365
366
case ConnectState . Connecting :
366
367
break ;
367
- case ConnectState . Disconnected :
368
- break ;
369
368
default :
370
369
break ;
371
370
}
You can’t perform that action at this time.
0 commit comments