Skip to content

Commit ffda171

Browse files
committed
cr update
1 parent f0b8a92 commit ffda171

2 files changed

Lines changed: 16 additions & 19 deletions

File tree

include/aws/mqtt/private/mqtt_iot_sdk_metrics.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef AWS_MQTT_IOT_SDK_METRICS_H
77
#define AWS_MQTT_IOT_SDK_METRICS_H
88

9-
/* IoT SDK Metrics */
9+
/* Storage for `aws_mqtt_iot_sdk_metrics`. */
1010
struct aws_mqtt_iot_sdk_metrics_storage {
1111
struct aws_allocator *allocator;
1212

@@ -23,8 +23,6 @@ AWS_MQTT_API struct aws_mqtt_iot_sdk_metrics_storage *aws_mqtt_iot_sdk_metrics_s
2323
struct aws_allocator *allocator,
2424
const struct aws_mqtt_iot_sdk_metrics *metrics_options);
2525

26-
AWS_MQTT_API size_t aws_mqtt_iot_sdk_metrics_compute_storage_size(const struct aws_mqtt_iot_sdk_metrics *metrics);
27-
2826
AWS_MQTT_API void aws_mqtt_iot_sdk_metrics_storage_destroy(struct aws_mqtt_iot_sdk_metrics_storage *metrics_storage);
2927

3028
/**

source/client.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,6 @@ static void s_mqtt_client_init(
629629
if (connection->username || connection->metrics_storage) {
630630
struct aws_byte_cursor username_cur;
631631
AWS_ZERO_STRUCT(username_cur);
632-
if (connection->username) {
633-
username_cur = aws_byte_cursor_from_string(connection->username);
634-
}
635632

636633
/* Apply metrics to username if configured */
637634
if (aws_mqtt_append_sdk_metrics_to_username(
@@ -646,22 +643,24 @@ static void s_mqtt_client_init(
646643
AWS_LS_MQTT_CLIENT, "id=%p: Failed to apply metrics to username, using original", (void *)connection);
647644
}
648645

649-
AWS_LOGF_DEBUG(
650-
AWS_LS_MQTT_CLIENT,
651-
"id=%p: Adding username " PRInSTR " to connection",
652-
(void *)connection,
653-
AWS_BYTE_CURSOR_PRI(username_cur));
646+
if (aws_byte_cursor_is_valid(&username_cur)) {
647+
AWS_LOGF_DEBUG(
648+
AWS_LS_MQTT_CLIENT,
649+
"id=%p: Adding username " PRInSTR " to connection",
650+
(void *)connection,
651+
AWS_BYTE_CURSOR_PRI(username_cur));
654652

655-
struct aws_byte_cursor password_cur = {
656-
.ptr = NULL,
657-
.len = 0,
658-
};
653+
struct aws_byte_cursor password_cur = {
654+
.ptr = NULL,
655+
.len = 0,
656+
};
659657

660-
if (connection->password) {
661-
password_cur = aws_byte_cursor_from_string(connection->password);
662-
}
658+
if (connection->password) {
659+
password_cur = aws_byte_cursor_from_string(connection->password);
660+
}
663661

664-
aws_mqtt_packet_connect_add_credentials(&connect, username_cur, password_cur);
662+
aws_mqtt_packet_connect_add_credentials(&connect, username_cur, password_cur);
663+
}
665664
}
666665

667666
message = mqtt_get_message_for_packet(connection, &connect.fixed_header);

0 commit comments

Comments
 (0)