Skip to content

Race condition on state solved

Pre-release
Pre-release

Choose a tag to compare

@TingDaoK TingDaoK released this 04 Aug 20:49
c334aa5
Connection revamp (#147)

## Issue
https://github.com/awslabs/aws-c-mqtt/issues/136
The state of connection is not thread-safe

## Solution
Taking a lock to protect the state from multiple threads.
But, we already have three locks for connection. Instead of introducing the fourth lock, revamp the connection structure to share the same lock.

## Changes made
- thread_data & synced_data as we did for aws-c-http. Using state of connection to product the configurations of connection.
- fix error for resubscribe. Similar to [Multiple sub bug](https://github.com/awslabs/aws-c-mqtt/pull/141). It's probably better to be in [tests](https://github.com/awslabs/aws-c-mqtt/pull/146). Involved some thread-safe fixes as well, so keep it here.
- Left a tons of todos, most of them are about the retry police & QoS 2. We will finish them in the near future?
- Documentation rewrite. Github readme needs update as well.
- Make sure the on_completed for requests function will be called in all situation.

## TODOs
- Retry police.
- We need to do the right thing for QoS 2 publish. If we want to fully support QoS 2.
- update github readme

Co-authored-by: Dengke Tang <dengket@amazon.com>