Skip to content

Commit ac02821

Browse files
committed
Review feedback
1 parent 513377c commit ac02821

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

src/mqtt_broker.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,8 +2454,12 @@ static void BrokerClient_PublishWillImmediate(MqttBroker* broker,
24542454
BrokerRetained_Delete(broker, topic);
24552455
}
24562456
else {
2457-
(void)BrokerRetained_Store(broker, topic, payload,
2457+
int ret_rc = BrokerRetained_Store(broker, topic, payload,
24582458
payload_len, 0);
2459+
if (ret_rc != MQTT_CODE_SUCCESS) {
2460+
WBLOG_ERR(broker, "Retained store failed: %s",
2461+
MqttClient_ReturnCodeToString(ret_rc));
2462+
}
24592463
}
24602464
}
24612465

@@ -3072,7 +3076,10 @@ static int BrokerHandle_Subscribe(BrokerClient* bc, int rx_len,
30723076

30733077
if (f && MqttDecode_Num((byte*)f - MQTT_DATA_LEN_SIZE,
30743078
&flen, MQTT_DATA_LEN_SIZE) == MQTT_DATA_LEN_SIZE) {
3075-
(void)BrokerSubs_Add(broker, bc, f, flen, topic_qos);
3079+
int sub_rc = BrokerSubs_Add(broker, bc, f, flen, topic_qos);
3080+
if (sub_rc != MQTT_CODE_SUCCESS) {
3081+
granted_qos = (MqttQoS)MQTT_SUBSCRIBE_ACK_CODE_FAILURE;
3082+
}
30763083

30773084
#ifdef WOLFMQTT_BROKER_RETAINED
30783085
/* Deliver retained messages matching this filter */
@@ -3249,8 +3256,14 @@ static int BrokerHandle_Publish(BrokerClient* bc, int rx_len,
32493256
}
32503257
}
32513258
#endif
3252-
(void)BrokerRetained_Store(broker, topic, payload,
3253-
pub.total_len, expiry);
3259+
{
3260+
int ret_rc = BrokerRetained_Store(broker, topic, payload,
3261+
pub.total_len, expiry);
3262+
if (ret_rc != MQTT_CODE_SUCCESS) {
3263+
WBLOG_ERR(broker, "Retained store failed: %s",
3264+
MqttClient_ReturnCodeToString(ret_rc));
3265+
}
3266+
}
32543267
}
32553268
}
32563269
#endif /* WOLFMQTT_BROKER_RETAINED */

0 commit comments

Comments
 (0)