From 01ead7e73e85b77b0921c3576a5a59ef8de5bf76 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Sat, 3 Mar 2018 11:04:47 +0100 Subject: [PATCH 1/4] websockets.c: unbreak build without TLS Commit 7943072b1f3b (Fix use_identity_as_username not working on websockets clients) added code which unconditionally accesses mosq-ssl, breaking the build when TLS support is disabled. Fix it by guarding this logic inside #ifdef WITH_TLS. Signed-off-by: Peter Korsgaard --- src/websockets.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/websockets.c b/src/websockets.c index d31f2996..bc5a365c 100644 --- a/src/websockets.c +++ b/src/websockets.c @@ -201,12 +201,14 @@ static int callback_mqtt(struct libwebsocket_context *context, mosq->ws_context = context; #endif mosq->wsi = wsi; +#ifdef WITH_TLS if(in){ mosq->ssl = (SSL *)in; if(!mosq->listener->ssl_ctx){ mosq->listener->ssl_ctx = SSL_get_SSL_CTX(mosq->ssl); } } +#endif u->mosq = mosq; }else{ return -1; @@ -240,7 +242,9 @@ static int callback_mqtt(struct libwebsocket_context *context, mosq->pollfd_index = -1; } mosq->wsi = NULL; +#ifdef WITH_TLS mosq->ssl = NULL; +#endif do_disconnect(db, mosq); } break; From a6aa3bc5f999de7476975ce274fabb97a5049fec Mon Sep 17 00:00:00 2001 From: hailinzeng Date: Thu, 29 Mar 2018 14:31:01 +0800 Subject: [PATCH 2/4] remove dead code Signed-off-by: hailinzeng --- src/database.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/database.c b/src/database.c index 1ea994a0..0bb73e0e 100644 --- a/src/database.c +++ b/src/database.c @@ -565,7 +565,6 @@ int mqtt3_db_message_store(struct mosquitto_db *db, const char *source, uint16_t if(!temp->payload){ if(temp->source_id) _mosquitto_free(temp->source_id); if(temp->topic) _mosquitto_free(temp->topic); - if(temp->payload) _mosquitto_free(temp->payload); _mosquitto_free(temp); return MOSQ_ERR_NOMEM; } From ee610ab19a445fa14a3b3e3dd3c14e0144b82594 Mon Sep 17 00:00:00 2001 From: "Thomas Beckmann (M-Way)" Date: Thu, 29 Mar 2018 08:44:57 +0200 Subject: [PATCH 3/4] _mosquitto_net_read must call WSASetLastError when changing errno so that the error code can be picked up by _mosquitto_packet_read Signed-off-by: Thomas Beckmann (M-Way) --- lib/net_mosq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 1aee1dd0..8337e0d1 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -784,6 +784,9 @@ ssize_t _mosquitto_net_read(struct mosquitto *mosq, void *buf, size_t count) } errno = EPROTO; } +#ifdef WIN32 + WSASetLastError(errno); +#endif } return (ssize_t )ret; }else{ From e4e6a67959024e1ae95108961188d77671bde312 Mon Sep 17 00:00:00 2001 From: Eric Schneeberger Date: Tue, 14 Nov 2017 10:45:35 -0600 Subject: [PATCH 4/4] Increase maximum connections (Windows) from 512 to 2048 (Maximum) Signed-off-by: Eric Schneeberger --- src/mosquitto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mosquitto.c b/src/mosquitto.c index b28150ce..857a10e0 100644 --- a/src/mosquitto.c +++ b/src/mosquitto.c @@ -217,7 +217,8 @@ int main(int argc, char *argv[]) int listensock_count = 0; int listensock_index = 0; struct mqtt3_config config; -#ifdef WITH_SYS_TREE + + #ifdef WITH_SYS_TREE char buf[1024]; #endif int i, j; @@ -226,6 +227,7 @@ int main(int argc, char *argv[]) int rc; #ifdef WIN32 SYSTEMTIME st; + _setmaxstdio(2048); #else struct timeval tv; #endif