Skip to content

Commit 63e8ce2

Browse files
committed
Release version 1.1.1
1 parent c20c9e9 commit 63e8ce2

22 files changed

+261
-204
lines changed

Changelog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
# Change Log
2+
3+
## [1.1.1](https://github.com/aws/aws-iot-device-sdk-cpp/releases/tag/v1.1.1) (July 13th, 2017)
4+
5+
Features:
6+
- N/A
7+
8+
Bugfixes/Improvements:
9+
- Fixed issues:
10+
- [#10](https://github.com/aws/aws-iot-device-sdk-cpp/issues/10) - Fix just-in-time-registration of device certs when using OpenSSL
11+
- [#12](https://github.com/aws/aws-iot-device-sdk-cpp/issues/12) - Stop receiving duplicate messages when using QoS 1
12+
- [#17](https://github.com/aws/aws-iot-device-sdk-cpp/issues/17) - Disconnect callback should be called even when auto-reconnect is disabled
13+
- [#18](https://github.com/aws/aws-iot-device-sdk-cpp/issues/18) - Clear subscriptions on disconnect
14+
- [#20](https://github.com/aws/aws-iot-device-sdk-cpp/issues/20) - Resubscribe to previously subscribed topic should not cause crash
15+
- [#23](https://github.com/aws/aws-iot-device-sdk-cpp/issues/23) - Fix memory leaks
16+
- Included pull requests:
17+
- [#24](https://github.com/aws/aws-iot-device-sdk-cpp/pull/24) - Fix cyclic refences
18+
- [#26](https://github.com/aws/aws-iot-device-sdk-cpp/pull/26) - Fix subscription API documentaion
19+
220
## [1.1.0](https://github.com/aws/aws-iot-device-sdk-cpp/releases/tag/v1.1.0) (May 8th, 2017)
321

422
Features:

KnownIssues.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Known Issues/Limitations
2-
## [1.1.0](https://github.com/aws/aws-iot-device-sdk-cpp/releases/tag/v1.1.0) (May 8th, 2017)
2+
## [1.1.1](https://github.com/aws/aws-iot-device-sdk-cpp/releases/tag/v1.1.1) (July 13th, 2017)
33

44
### Common
55

66
- Client Core - Reduce shared pointer usage, figure out ways to use fewer copy operations
77
- Network Read - Add recovery options for out of sync buffers
88
- Network Layer, Common - Currently, vector resize is called before the vector is passed for reading in data. Determine if a more flexible solution is possible with fewer allocations
99
- Network Layer, OpenSSL - error handling for library API calls
10+
- Network Layer, OpenSSL - memory leak
1011
- Network Layer, WebSocket - Refactor WSLay and merge it with the WebSocket wrapper, improve testing
1112
- Network Layer, WebSocket - TLS Read and Write are highly inefficient in current implementation, improvements required
1213
- Network Layer, Common - Add support for IPv6, remove deprecated system API calls

common/ConfigCommon.cpp

Lines changed: 40 additions & 130 deletions
Large diffs are not rendered by default.

common/ConfigCommon.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ namespace awsiotsdk {
3131
class ConfigCommon {
3232
protected:
3333
static util::JsonDocument sdk_config_json_;
34+
35+
static void LogParseError(const ResponseCode& response_code, const util::JsonDocument& config, util::String key);
3436
public:
3537
static uint16_t endpoint_mqtt_port_;
3638
static uint16_t endpoint_https_port_;

common/SwitchConfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"maximum_acks_to_wait_for": 32,
2424
"action_processing_rate_hz": 5,
2525
"maximum_outgoing_action_queue_length": 32,
26-
"discover_action_timeout_msecs": 300000
26+
"discover_action_timeout_msecs": 300000,
27+
"switch_target_thing": "RobotArm_Thing"
2728
}

include/ClientCoreState.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,22 @@ namespace awsiotsdk {
271271
*/
272272
void DeleteExpiredAcks();
273273

274+
/**
275+
* @brief Clears all registered Actions
276+
*
277+
* Utility method to remove all registered actions by the client.
278+
* Also helps in breaking out of cyclic reference introduced when ::RegisterAction is called.
279+
*/
280+
void ClearRegisteredActions();
281+
282+
/**
283+
* @brief Clears all pending outbound Actions.
284+
*
285+
* Utility method to remove all pending outbound actions registered by the client.
286+
* Also helps in breaking out of cyclic reference introduced when ::EnqueueOutboundAction is called.
287+
*/
288+
void ClearOutboundActionQueue();
289+
274290
/**
275291
* @brief Default Constructor
276292
*/

include/mqtt/Client.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ namespace awsiotsdk {
169169
* Performs a MQTT Subscribe operation in blocking mode. Action timeout here is the time for which
170170
* the client waits for a response AFTER the request is sent.
171171
*
172-
* @param p_subscribe_packet - Subscribe packet to use for the operation
172+
* @param subscription_list - A list of subscriptions to use for the operation
173173
* @param action_response_timeout - Timeout in milliseconds within which response should be obtained after request is sent
174174
*
175175
* @return ResponseCode indicating status of request
@@ -225,7 +225,7 @@ namespace awsiotsdk {
225225
* activates Subscription if successful SUBACK is received. If not, the assigned Ack handler will be called
226226
* with the corrosponding ResponseCode
227227
*
228-
* @param p_subscribe_packet - Subscribe packet to use for the operation
228+
* @param subscription_list - A list of subscriptions to use for the operation
229229
* @param p_async_ack_handler - AsyncAck notification handler to be called when response for this request is processed
230230
* @param packet_id_out - Packet ID assigned to outgoing packet
231231
*

include/mqtt/ClientState.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ namespace awsiotsdk {
5050
std::chrono::milliseconds mqtt_command_timeout_;
5151

5252
std::shared_ptr<ActionData> p_connect_data_;
53+
54+
std::atomic_bool trigger_disconnect_callback_;
5355
public:
5456
util::Map<util::String, std::shared_ptr<Subscription>> subscription_map_;
5557

@@ -86,6 +88,9 @@ namespace awsiotsdk {
8688
bool IsPingreqPending() { return is_pingreq_pending_; }
8789
void SetPingreqPending(bool value) { is_pingreq_pending_ = value; }
8890

91+
bool isDisconnectCallbackPending() { return trigger_disconnect_callback_; }
92+
void setDisconnectCallbackPending(bool value) { trigger_disconnect_callback_ = value; }
93+
8994
virtual uint16_t GetNextPacketId();
9095
virtual uint16_t GetNextActionId() { return GetNextPacketId(); }
9196

include/mqtt/Publish.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ namespace awsiotsdk {
163163
* This class defines the Packet type used in MQTT to Acknowledge Publish requests
164164
*/
165165
class PubackPacket : public Packet {
166+
protected:
167+
std::atomic_uint_fast16_t publish_packet_id_;
166168
public:
167169
// Ensure Default Constructor is deleted, default to move and copy constructors and assignment operators
168170
// Default virtual destructor
@@ -184,20 +186,23 @@ namespace awsiotsdk {
184186
*
185187
* @param packet_id Packet ID for this Puback
186188
*/
187-
PubackPacket(uint16_t packet_id);
189+
PubackPacket(uint16_t publish_packet_id);
188190

189191
/**
190192
* @brief Factory Create method
191193
* @param packet_id Packet ID for this Puback
192194
* @return nullptr on error, shared_ptr pointing to a created PubackPacket instance if successful
193195
*/
194-
static std::shared_ptr<PubackPacket> Create(uint16_t packet_id);
196+
static std::shared_ptr<PubackPacket> Create(uint16_t publish_packet_id);
195197

196198
/**
197199
* @brief Serialize this packet into a String
198200
* @return String containing serialized packet
199201
*/
200202
util::String ToString();
203+
204+
uint16_t GetPublishPacketId() { return publish_packet_id_; }
205+
void SetPublishPacketId(uint16_t publish_packet_id) { publish_packet_id_ = publish_packet_id; }
201206
};
202207

203208
/**

network/MbedTLS/MbedTLSConnection.cpp

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ namespace awsiotsdk {
5151
flags_ = 0;
5252

5353
is_connected_ = false;
54+
requires_free_ = false;
5455
}
5556

5657
bool MbedTLSConnection::IsPhysicalLayerConnected() {
@@ -96,6 +97,8 @@ namespace awsiotsdk {
9697
mbedtls_x509_crt_init(&clicert_);
9798
mbedtls_pk_init(&pkey_);
9899

100+
requires_free_ = true;
101+
99102
AWS_LOG_INFO(MBEDTLS_WRAPPER_LOG_TAG, "...............................%d", MBEDTLS_SSL_MAX_CONTENT_LEN);
100103

101104
AWS_LOG_INFO(MBEDTLS_WRAPPER_LOG_TAG, "....Seeding the random number generator...");
@@ -106,7 +109,7 @@ namespace awsiotsdk {
106109
return ResponseCode::NETWORK_SSL_INIT_ERROR;
107110
}
108111

109-
AWS_LOG_INFO(MBEDTLS_WRAPPER_LOG_TAG, "....Loading the CA root certificate...");
112+
AWS_LOG_INFO(MBEDTLS_WRAPPER_LOG_TAG, "....Loading the CA root certificate... %s", root_ca_location_.c_str());
110113
ret = mbedtls_x509_crt_parse_file(&cacert_, root_ca_location_.c_str());
111114
if (ret < 0) {
112115
AWS_LOG_ERROR(MBEDTLS_WRAPPER_LOG_TAG,
@@ -181,11 +184,6 @@ namespace awsiotsdk {
181184
}
182185

183186
mbedtls_ssl_conf_read_timeout(&conf_, static_cast<uint32_t>(tls_handshake_timeout_.count()));
184-
185-
if ((ret = mbedtls_ssl_setup(&ssl_, &conf_)) != 0) {
186-
AWS_LOG_ERROR(MBEDTLS_WRAPPER_LOG_TAG, "Failed!!! mbedtls_ssl_setup returned -0x%x\n\n", -ret);
187-
return ResponseCode::NETWORK_SSL_UNKNOWN_ERROR;
188-
}
189187
if ((ret = mbedtls_ssl_set_hostname(&ssl_, endpoint_.c_str())) != 0) {
190188
AWS_LOG_ERROR(MBEDTLS_WRAPPER_LOG_TAG, "Failed!!! mbedtls_ssl_set_hostname returned %d\n\n", ret);
191189
return ResponseCode::NETWORK_SSL_UNKNOWN_ERROR;
@@ -194,6 +192,11 @@ namespace awsiotsdk {
194192
mbedtls_ssl_set_bio(&ssl_, &server_fd_, mbedtls_net_send, NULL, mbedtls_net_recv_timeout);
195193
AWS_LOG_INFO(MBEDTLS_WRAPPER_LOG_TAG, "Ok!");
196194

195+
if ((ret = mbedtls_ssl_setup(&ssl_, &conf_)) != 0) {
196+
AWS_LOG_ERROR(MBEDTLS_WRAPPER_LOG_TAG, "Failed!!! mbedtls_ssl_setup returned -0x%x\n\n", -ret);
197+
return ResponseCode::NETWORK_SSL_UNKNOWN_ERROR;
198+
}
199+
197200
AWS_LOG_INFO(MBEDTLS_WRAPPER_LOG_TAG, "\n\nSSL state connect : %d ", ssl_.state);
198201
AWS_LOG_INFO(MBEDTLS_WRAPPER_LOG_TAG, "....Performing the SSL/TLS handshake...");
199202
while ((ret = mbedtls_ssl_handshake(&ssl_)) != 0) {
@@ -311,10 +314,25 @@ namespace awsiotsdk {
311314
}
312315

313316
ResponseCode MbedTLSConnection::DisconnectInternal() {
314-
int ret = 0;
315-
do {
316-
ret = mbedtls_ssl_close_notify(&ssl_);
317-
} while (ret == MBEDTLS_ERR_SSL_WANT_WRITE);
317+
if (is_connected_) {
318+
int ret = 0;
319+
do {
320+
ret = mbedtls_ssl_close_notify(&ssl_);
321+
} while (ret == MBEDTLS_ERR_SSL_WANT_WRITE);
322+
}
323+
324+
if(requires_free_) {
325+
mbedtls_net_free(&server_fd_);
326+
327+
mbedtls_x509_crt_free(&clicert_);
328+
mbedtls_x509_crt_free(&cacert_);
329+
mbedtls_pk_free(&pkey_);
330+
mbedtls_ssl_free(&ssl_);
331+
mbedtls_ssl_config_free(&conf_);
332+
mbedtls_ctr_drbg_free(&ctr_drbg_);
333+
mbedtls_entropy_free(&entropy_);
334+
requires_free_ = false;
335+
}
318336

319337
is_connected_ = false;
320338

@@ -324,19 +342,7 @@ namespace awsiotsdk {
324342
}
325343

326344
MbedTLSConnection::~MbedTLSConnection() {
327-
if (is_connected_) {
328-
Disconnect();
329-
}
330-
331-
mbedtls_net_free(&server_fd_);
332-
333-
mbedtls_x509_crt_free(&clicert_);
334-
mbedtls_x509_crt_free(&cacert_);
335-
mbedtls_pk_free(&pkey_);
336-
mbedtls_ssl_free(&ssl_);
337-
mbedtls_ssl_config_free(&conf_);
338-
mbedtls_ctr_drbg_free(&ctr_drbg_);
339-
mbedtls_entropy_free(&entropy_);
345+
Disconnect();
340346
}
341347
}
342348
}

0 commit comments

Comments
 (0)