Log protocol error message where appropriate from a bad UNSUBSCRIBE

Rather than the generic "socket error".

Related to #1765.
pull/1769/head
Roger A. Light 5 years ago
parent 2b1a22776b
commit 1f717873d6

@ -15,6 +15,8 @@ Broker:
Closes #1718.
- Fix "slow" file based logging by switching to line based buffering.
Closes #1689. Closes #1741.
- Log protocol error message where appropriate from a bad UNSUBSCRIBE, rather
than the generic "socket error".
Client library:
- Improved documentation around connect callback return codes. Close #1730.

@ -49,7 +49,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
return MOSQ_ERR_PROTOCOL;
}
}
if(packet__read_uint16(&context->in_packet, &mid)) return 1;
if(packet__read_uint16(&context->in_packet, &mid)) return MOSQ_ERR_PROTOCOL;
if(mid == 0) return MOSQ_ERR_PROTOCOL;
if(context->protocol == mosq_p_mqtt5){
@ -76,7 +76,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
sub = NULL;
if(packet__read_string(&context->in_packet, &sub, &slen)){
mosquitto__free(reason_codes);
return 1;
return MOSQ_ERR_PROTOCOL;
}
if(!slen){
@ -85,7 +85,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
context->id);
mosquitto__free(sub);
mosquitto__free(reason_codes);
return 1;
return MOSQ_ERR_PROTOCOL;
}
if(mosquitto_sub_topic_check(sub)){
log__printf(NULL, MOSQ_LOG_INFO,
@ -93,7 +93,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
context->id);
mosquitto__free(sub);
mosquitto__free(reason_codes);
return 1;
return MOSQ_ERR_PROTOCOL;
}
log__printf(NULL, MOSQ_LOG_DEBUG, "\t%s", sub);

Loading…
Cancel
Save