Skip to content

Commit

Permalink
fix(IoT): Fixing a potential race condition on topic listeners (#5402)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas authored Jul 16, 2024
1 parent b63dd81 commit 08bf417
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion AWSComprehendTests/AWSComprehendTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AWSComprehendTests: XCTestCase {
let comprehendClient = AWSComprehend.default()
let detectSentimentRequest = AWSComprehendDetectSentimentRequest()
detectSentimentRequest!.languageCode = AWSComprehendLanguageCode.en
detectSentimentRequest!.text = "I have no strong feelings one way or the other"
detectSentimentRequest!.text = "This sentence is a statement of fact"

comprehendClient.detectSentiment(detectSentimentRequest!).continueWith{ (task)-> Any? in
if let error = task.error {
Expand Down
4 changes: 2 additions & 2 deletions AWSIoT/Internal/AWSIoTMQTTClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ @interface AWSIoTMQTTClient() <AWSSRWebSocketDelegate, NSStreamDelegate, AWSMQTT

@property(atomic, assign, readwrite) AWSIoTMQTTStatus mqttStatus;
@property(nonatomic, strong) AWSMQTTSession* session;
@property(nonatomic, strong) NSMutableDictionary * topicListeners;
@property(nonatomic, strong) AWSSynchronizedMutableDictionary * topicListeners;

@property(atomic, assign) BOOL userDidIssueDisconnect; //Flag to indicate if requestor has issued a disconnect
@property(atomic, assign) BOOL userDidIssueConnect; //Flag to indicate if requestor has issued a connect
Expand Down Expand Up @@ -91,7 +91,7 @@ @implementation AWSIoTMQTTClient

- (instancetype)init {
if (self = [super init]) {
_topicListeners = [NSMutableDictionary dictionary];
_topicListeners = [AWSSynchronizedMutableDictionary new];
_clientCerts = nil;
_session.delegate = nil;
_session = nil;
Expand Down
24 changes: 19 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# AWS Mobile SDK for iOS CHANGELOG

## Unreleased

### Bug Fixes

- **AWSIoT**
- Fixing a potential race condition on topic listeners (#5402)

## 2.36.5

### New features

- **AWSIoT**
- Adding completion callbacks for registerWithShadow and unregisterFromShadow methods (#5192)

### Misc. Updates

- Model updates for the following services
Expand All @@ -16,11 +30,11 @@
- AWSFirehose
- AWSTranscribe

- **AWSS3**
- fix(s3): cleanup file cache after mpu task is cancelled (#5128)
- **AWSIOT**
- feat(IoT): Adding completion callbacks for registerWithShadow and unregisterFromShadow methods (#5192)
## 2.36.4

### Deprecated release

This release is deprecated due to errors. Please use 2.36.5 or greater.

## 2.36.3

Expand Down

0 comments on commit 08bf417

Please sign in to comment.