Allow send__pub{ack,rec,rel,comp} to send properties.

This commit is contained in:
Roger A. Light
2020-07-10 12:29:53 +01:00
parent 318dead6bf
commit e3e8dc4ea4
10 changed files with 36 additions and 36 deletions
+2 -2
View File
@@ -135,7 +135,7 @@ int handle__publish(struct mosquitto *mosq)
return MOSQ_ERR_SUCCESS;
case 1:
util__decrement_receive_quota(mosq);
rc = send__puback(mosq, message->msg.mid, 0);
rc = send__puback(mosq, message->msg.mid, 0, NULL);
pthread_mutex_lock(&mosq->callback_mutex);
if(mosq->on_message){
mosq->in_callback = true;
@@ -154,7 +154,7 @@ int handle__publish(struct mosquitto *mosq)
case 2:
message->properties = properties;
util__decrement_receive_quota(mosq);
rc = send__pubrec(mosq, message->msg.mid, 0);
rc = send__pubrec(mosq, message->msg.mid, 0, NULL);
pthread_mutex_lock(&mosq->msgs_in.mutex);
message->state = mosq_ms_wait_for_pubrel;
message__queue(mosq, message, mosq_md_in);
+1 -1
View File
@@ -104,7 +104,7 @@ int handle__pubrec(struct mosquitto_db *db, struct mosquitto *mosq)
}else if(rc != MOSQ_ERR_SUCCESS){
return rc;
}
rc = send__pubrel(mosq, mid);
rc = send__pubrel(mosq, mid, NULL);
if(rc) return rc;
return MOSQ_ERR_SUCCESS;
+2 -2
View File
@@ -87,14 +87,14 @@ int handle__pubrel(struct mosquitto_db *db, struct mosquitto *mosq)
return rc;
}
rc = send__pubcomp(mosq, mid);
rc = send__pubcomp(mosq, mid, NULL);
if(rc) return rc;
#else
UNUSED(db);
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREL (Mid: %d)", mosq->id, mid);
rc = send__pubcomp(mosq, mid);
rc = send__pubcomp(mosq, mid, NULL);
if(rc){
message__remove(mosq, mid, mosq_md_in, &message, 2);
return rc;
+2 -2
View File
@@ -292,13 +292,13 @@ void message__retry_check(struct mosquitto *mosq)
case mosq_ms_wait_for_pubrel:
msg->timestamp = now;
msg->dup = true;
send__pubrec(mosq, msg->msg.mid, 0);
send__pubrec(mosq, msg->msg.mid, 0, NULL);
break;
case mosq_ms_resend_pubrel:
case mosq_ms_wait_for_pubcomp:
msg->timestamp = now;
msg->dup = true;
send__pubrel(mosq, msg->msg.mid);
send__pubrel(mosq, msg->msg.mid, NULL);
break;
default:
break;
+8 -8
View File
@@ -65,7 +65,7 @@ int send__pingresp(struct mosquitto *mosq)
return send__simple_command(mosq, CMD_PINGRESP);
}
int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code)
int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
{
#ifdef WITH_BROKER
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBACK to %s (m%d, rc%d)", mosq->id, mid, reason_code);
@@ -74,10 +74,10 @@ int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code)
#endif
util__increment_receive_quota(mosq);
/* We don't use Reason String or User Property yet. */
return send__command_with_mid(mosq, CMD_PUBACK, mid, false, reason_code, NULL);
return send__command_with_mid(mosq, CMD_PUBACK, mid, false, reason_code, properties);
}
int send__pubcomp(struct mosquitto *mosq, uint16_t mid)
int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
{
#ifdef WITH_BROKER
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBCOMP to %s (m%d)", mosq->id, mid);
@@ -86,11 +86,11 @@ int send__pubcomp(struct mosquitto *mosq, uint16_t mid)
#endif
util__increment_receive_quota(mosq);
/* We don't use Reason String or User Property yet. */
return send__command_with_mid(mosq, CMD_PUBCOMP, mid, false, 0, NULL);
return send__command_with_mid(mosq, CMD_PUBCOMP, mid, false, 0, properties);
}
int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code)
int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
{
#ifdef WITH_BROKER
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREC to %s (m%d, rc%d)", mosq->id, mid, reason_code);
@@ -101,10 +101,10 @@ int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code)
util__increment_receive_quota(mosq);
}
/* We don't use Reason String or User Property yet. */
return send__command_with_mid(mosq, CMD_PUBREC, mid, false, reason_code, NULL);
return send__command_with_mid(mosq, CMD_PUBREC, mid, false, reason_code, properties);
}
int send__pubrel(struct mosquitto *mosq, uint16_t mid)
int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
{
#ifdef WITH_BROKER
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREL to %s (m%d)", mosq->id, mid);
@@ -112,7 +112,7 @@ int send__pubrel(struct mosquitto *mosq, uint16_t mid)
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREL (m%d)", mosq->id, mid);
#endif
/* We don't use Reason String or User Property yet. */
return send__command_with_mid(mosq, CMD_PUBREL|2, mid, false, 0, NULL);
return send__command_with_mid(mosq, CMD_PUBREL|2, mid, false, 0, properties);
}
/* For PUBACK, PUBCOMP, PUBREC, and PUBREL */
+4 -4
View File
@@ -27,11 +27,11 @@ int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session
int send__disconnect(struct mosquitto *mosq, uint8_t reason_code, const mosquitto_property *properties);
int send__pingreq(struct mosquitto *mosq);
int send__pingresp(struct mosquitto *mosq);
int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code);
int send__pubcomp(struct mosquitto *mosq, uint16_t mid);
int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties);
int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties);
int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const mosquitto_property *cmsg_props, const mosquitto_property *store_props, uint32_t expiry_interval);
int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code);
int send__pubrel(struct mosquitto *mosq, uint16_t mid);
int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties);
int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties);
int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, char *const *const topic, int topic_qos, const mosquitto_property *properties);
int send__unsubscribe(struct mosquitto *mosq, int *mid, int topic_count, char *const *const topic, const mosquitto_property *properties);