From 73f755acc4b56d65038418ab9861a49c815cec5d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 16 Sep 2015 17:38:54 +0100 Subject: [PATCH 1/6] New openssl version. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c730d811..8aaeb39c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ environment: CMAKE_ARGS: -DCMAKE_BUILD_TYPE=Release NSIS_ROOT: C:\nsis - SSL_VER: 1_0_2c + SSL_VER: 1_0_2d configuration: - Release From 0c0961f6a4ab5f9df84a5d6a9a2b60625ea7a87e Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 16 Sep 2015 17:39:00 +0100 Subject: [PATCH 2/6] [477571] Fix socket leak with bridges. Don't leak sockets when an outgoing bridge connection with multiple addresses is rejected. Thanks to Johnny Egeland. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=477571 --- ChangeLog.txt | 9 +++++++++ src/loop.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6d3cd89b..581d7904 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,11 @@ +1.x.x - 2015xxxx +================ + +Broker: +- Don't leak sockets when outgoing bridge with multiple addresses cannot + connect. Closes #477571. + + 1.4.3 - 20150818 ================ @@ -22,6 +30,7 @@ Client library: Clients: - Report error string on connection failure rather than error code. + 1.4.2 - 20150507 ================ diff --git a/src/loop.c b/src/loop.c index 8c7fbf9f..5970a0d9 100644 --- a/src/loop.c +++ b/src/loop.c @@ -178,7 +178,7 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li && context->bridge->cur_address != 0 && now > context->bridge->primary_retry){ - if(_mosquitto_try_connect(context, context->bridge->addresses[0].address, context->bridge->addresses[0].port, &bridge_sock, NULL, false) == MOSQ_ERR_SUCCESS){ + if(_mosquitto_try_connect(context, context->bridge->addresses[0].address, context->bridge->addresses[0].port, &bridge_sock, NULL, false) <= 0){ COMPAT_CLOSE(bridge_sock); _mosquitto_socket_close(db, context); context->bridge->cur_address = context->bridge->address_count-1; From 2597da17c254e9713a8774b156aff8eda5d7d17d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 16 Sep 2015 21:13:03 +0100 Subject: [PATCH 3/6] [475807] Fix cross compiling of websockets. Thanks to Tyler Brandon. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475807 --- ChangeLog.txt | 1 + src/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 581d7904..b7f27859 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ Broker: - Don't leak sockets when outgoing bridge with multiple addresses cannot connect. Closes #477571. +- Fix cross compiling of websockets. Closes #475807. 1.4.3 - 20150818 diff --git a/src/Makefile b/src/Makefile index 2cfb7d40..2bc70dec 100644 --- a/src/Makefile +++ b/src/Makefile @@ -90,7 +90,7 @@ util_mosq.o : ../lib/util_mosq.c ../lib/util_mosq.h ${CROSS_COMPILE}${CC} $(BROKER_CFLAGS) -c $< -o $@ websockets.o : websockets.c mosquitto_broker.h - ${CC} $(BROKER_CFLAGS) -c $< -o $@ + ${CROSS_COMPILE}${CC} $(BROKER_CFLAGS) -c $< -o $@ will_mosq.o : ../lib/will_mosq.c ../lib/will_mosq.h ${CROSS_COMPILE}${CC} $(BROKER_CFLAGS) -c $< -o $@ From 17e942e9b5c296c59c9509b290cf817c66439b3d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 16 Sep 2015 21:20:40 +0100 Subject: [PATCH 4/6] [475707] Fix free related crash on openwrt. Thanks to Karl Palsson. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475707 --- ChangeLog.txt | 1 + lib/memory_mosq.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index b7f27859..320d4ab6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,7 @@ Broker: - Don't leak sockets when outgoing bridge with multiple addresses cannot connect. Closes #477571. - Fix cross compiling of websockets. Closes #475807. +- Fix memory free related crashes on openwrt. Closes #475707. 1.4.3 - 20150818 diff --git a/lib/memory_mosq.c b/lib/memory_mosq.c index 1b7e61b3..dd3c50d0 100644 --- a/lib/memory_mosq.c +++ b/lib/memory_mosq.c @@ -54,6 +54,9 @@ void *_mosquitto_calloc(size_t nmemb, size_t size) void _mosquitto_free(void *mem) { #ifdef REAL_WITH_MEMORY_TRACKING + if(!mem){ + return; + } memcount -= malloc_usable_size(mem); #endif free(mem); From 011de7ed19a911fddd0a19f3aa8a95de70acc4ca Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 16 Sep 2015 22:14:26 +0100 Subject: [PATCH 5/6] Fix excessive calls to message retry check. --- ChangeLog.txt | 1 + src/loop.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 320d4ab6..26b6d8ed 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,7 @@ Broker: connect. Closes #477571. - Fix cross compiling of websockets. Closes #475807. - Fix memory free related crashes on openwrt. Closes #475707. +- Fix excessive calls to message retry check. 1.4.3 - 20150818 diff --git a/src/loop.c b/src/loop.c index 5970a0d9..a5f624b3 100644 --- a/src/loop.c +++ b/src/loop.c @@ -115,6 +115,7 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li #endif int context_count; time_t expiration_check_time = 0; + time_t last_timeout_check = 0; char *id; #ifndef WIN32 @@ -307,7 +308,11 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li expiration_check_time = time(NULL) + 3600; } - mqtt3_db_message_timeout_check(db, db->config->retry_interval); + if(last_timeout_check < mosquitto_time()){ + /* Only check at most once per second. */ + mqtt3_db_message_timeout_check(db, db->config->retry_interval); + last_timeout_check = mosquitto_time(); + } #ifndef WIN32 sigprocmask(SIG_SETMASK, &sigblock, &origsig); From 720d52d86e38f82f36dc462473c18fda8e0854d1 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 16 Sep 2015 22:53:01 +0100 Subject: [PATCH 6/6] Bump version number. --- CMakeLists.txt | 2 +- ChangeLog.txt | 2 +- config.mk | 2 +- installer/mosquitto-cygwin.nsi | 2 +- installer/mosquitto.nsi | 2 +- lib/mosquitto.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83f52c1b..d151a814 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(mosquitto) cmake_minimum_required(VERSION 2.8) # Only for version 3 and up. cmake_policy(SET CMP0042 NEW) -set (VERSION 1.4.3) +set (VERSION 1.4.4) if (WIN32) execute_process(COMMAND cmd /c echo %DATE% %TIME% OUTPUT_VARIABLE TIMESTAMP diff --git a/ChangeLog.txt b/ChangeLog.txt index 26b6d8ed..0d083a5e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,4 @@ -1.x.x - 2015xxxx +1.4.4 - 20150916 ================ Broker: diff --git a/config.mk b/config.mk index 2d377e19..33e206c9 100644 --- a/config.mk +++ b/config.mk @@ -83,7 +83,7 @@ WITH_SOCKS:=yes # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi -VERSION=1.4.3 +VERSION=1.4.4 TIMESTAMP:=$(shell date "+%F %T%z") # Client library SO version. Bump if incompatible API/ABI changes are made. diff --git a/installer/mosquitto-cygwin.nsi b/installer/mosquitto-cygwin.nsi index f189cc70..6fcfc34d 100644 --- a/installer/mosquitto-cygwin.nsi +++ b/installer/mosquitto-cygwin.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.4.3 +!define VERSION 1.4.4 OutFile "mosquitto-${VERSION}-install-cygwin.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index a2c2dfbb..f6f5b7a3 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.4.3 +!define VERSION 1.4.4 OutFile "mosquitto-${VERSION}-install-win32.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/lib/mosquitto.h b/lib/mosquitto.h index 8208e919..f84dd630 100644 --- a/lib/mosquitto.h +++ b/lib/mosquitto.h @@ -45,7 +45,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 1 #define LIBMOSQUITTO_MINOR 4 -#define LIBMOSQUITTO_REVISION 3 +#define LIBMOSQUITTO_REVISION 4 /* LIBMOSQUITTO_VERSION_NUMBER looks like 1002001 for e.g. version 1.2.1. */ #define LIBMOSQUITTO_VERSION_NUMBER (LIBMOSQUITTO_MAJOR*1000000+LIBMOSQUITTO_MINOR*1000+LIBMOSQUITTO_REVISION)