From 7ae7d73fd4490d359fe89df992c13a5efb8dca17 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 7 Oct 2020 17:21:14 +0100 Subject: [PATCH] The loop in packet_write() means that `max_packets` isn't needed. --- lib/loop.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/loop.c b/lib/loop.c index 249bbce8..fd3a98cd 100644 --- a/lib/loop.c +++ b/lib/loop.c @@ -410,18 +410,6 @@ int mosquitto_loop_write(struct mosquitto *mosq, int max_packets) int i; if(max_packets < 1) return MOSQ_ERR_INVAL; - pthread_mutex_lock(&mosq->msgs_out.mutex); - max_packets = mosq->msgs_out.queue_len; - pthread_mutex_unlock(&mosq->msgs_out.mutex); - - pthread_mutex_lock(&mosq->msgs_in.mutex); - max_packets += mosq->msgs_in.queue_len; - pthread_mutex_unlock(&mosq->msgs_in.mutex); - - if(max_packets < 1) max_packets = 1; - /* Queue len here tells us how many messages are awaiting processing and - * have QoS > 0. We should try to deal with that many in this loop in order - * to keep up. */ for(i=0; i