From b6f2d3e08785ab009814596e7e464973bdf62bab Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 16 May 2014 10:20:45 +0100 Subject: [PATCH] Fix callback deadlocks after calling mosquitto_disconnect(), when using the threaded interfaces. Closes bug #1313725. Thanks to Michael Frommberger. --- ChangeLog.txt | 2 ++ lib/net_mosq.c | 1 + 2 files changed, 3 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 02782d30..d51cdd20 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -18,6 +18,8 @@ Broker: Client library: - Fix topic matching edge case. +- Fix callback deadlocks after calling mosquitto_disconnect(), when using the + threaded interfaces. Closes bug #1313725. General: - Use $(STRIP) for stripping binaries when installing, to allow easier cross diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 42ea4ce9..a3977e25 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -776,6 +776,7 @@ int _mosquitto_packet_write(struct mosquitto *mosq) mosq->on_disconnect(mosq, mosq->userdata, 0); mosq->in_callback = false; } + pthread_mutex_unlock(&mosq->callback_mutex); pthread_mutex_unlock(&mosq->current_out_packet_mutex); return MOSQ_ERR_SUCCESS; }