From e09213c125c282a5252452f5adc1a67156a28e1b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 10 Dec 2024 18:54:12 +0000 Subject: [PATCH] Make use of full buffer --- lib/packet_mosq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c index 28fad89e6..19a83c292 100644 --- a/lib/packet_mosq.c +++ b/lib/packet_mosq.c @@ -353,8 +353,7 @@ static int read_header(struct mosquitto *mosq, ssize_t (*func_read)(struct mosqu { ssize_t read_length; - mosq->in_packet.packet_buffer_pos = 0; - read_length = func_read(mosq, mosq->in_packet.packet_buffer, mosq->in_packet.packet_buffer_size); + read_length = func_read(mosq, &mosq->in_packet.packet_buffer[mosq->in_packet.packet_buffer_pos], mosq->in_packet.packet_buffer_size-mosq->in_packet.packet_buffer_pos); if(read_length > 0){ mosq->in_packet.packet_buffer_to_process = (uint16_t)read_length; #ifdef WITH_BROKER @@ -404,6 +403,8 @@ static int packet__read_single(struct mosquitto *mosq, enum mosquitto_client_sta if(!(mosq->bridge) && state == mosq_cs_new && (mosq->in_packet.command&0xF0) != CMD_CONNECT){ return MOSQ_ERR_PROTOCOL; } +#else + UNUSED(state); #endif } }