Skip to content

Commit 582e289

Browse files
authored
fix(IoT): Fixing a race condition when invalidating/creating the reconnect timer (#5454)
1 parent ce10c22 commit 582e289

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

AWSIoT/Internal/AWSIoTMQTTClient.m

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,19 @@ - (void)cleanupReconnectTimer {
690690
waitUntilDone:NO];
691691
return;
692692
}
693-
694-
[self.reconnectTimer invalidate];
695-
self.reconnectTimer = nil;
693+
694+
[self invalidateReconnectTimer];
696695
}
697696
}
698697

698+
- (void)invalidateReconnectTimer {
699+
__weak AWSIoTMQTTClient *weakSelf = self;
700+
dispatch_async(self.timerQueue, ^{
701+
[weakSelf.reconnectTimer invalidate];
702+
weakSelf.reconnectTimer = nil;
703+
});
704+
}
705+
699706
- (void)cleanUpWebsocketOutputStream {
700707
@synchronized(self) {
701708
if (self.websocketOutputStream) {

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## Unreleased
44

5-
-Features for next release
5+
### Bug Fixes
6+
7+
- **AWSIoT**
8+
- Fixing a race condition when invalidating/creating the reconnect timer (#5454)
69

710
## 2.38.0
811

0 commit comments

Comments
 (0)