Skip to content

Commit 5466885

Browse files
authored
Merge pull request #4 from fabianmoronzirfas/chore/update-lib
update libs to latest version
2 parents e0a8881 + b70a008 commit 5466885

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

libs/mosquitto/src/messages_mosq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ void _mosquitto_messages_reconnect_reset(struct mosquitto *mosq)
192192
mosq->out_queue_len++;
193193
message->timestamp = 0;
194194

195-
if(message->msg.qos > 0){
196-
mosq->inflight_messages++;
197-
}
198195
if(mosq->max_inflight_messages == 0 || mosq->inflight_messages < mosq->max_inflight_messages){
196+
if(message->msg.qos > 0){
197+
mosq->inflight_messages++;
198+
}
199199
if(message->msg.qos == 1){
200200
message->state = mosq_ms_wait_for_puback;
201201
}else if(message->msg.qos == 2){

libs/mosquitto/src/mosquitto.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,15 @@ static int _mosquitto_connect_init(struct mosquitto *mosq, const char *host, int
407407

408408
mosq->keepalive = keepalive;
409409

410+
if(mosq->sockpairR != INVALID_SOCKET){
411+
COMPAT_CLOSE(mosq->sockpairR);
412+
mosq->sockpairR = INVALID_SOCKET;
413+
}
414+
if(mosq->sockpairW != INVALID_SOCKET){
415+
COMPAT_CLOSE(mosq->sockpairW);
416+
mosq->sockpairW = INVALID_SOCKET;
417+
}
418+
410419
if(_mosquitto_socketpair(&mosq->sockpairR, &mosq->sockpairW)){
411420
_mosquitto_log_printf(mosq, MOSQ_LOG_WARNING,
412421
"Warning: Unable to open socket pair, outgoing publish commands may be delayed.");
@@ -854,7 +863,6 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets)
854863
if(mosq->ssl){
855864
if(mosq->want_write){
856865
FD_SET(mosq->sock, &writefds);
857-
mosq->want_write = false;
858866
}else if(mosq->want_connect){
859867
/* Remove possible FD_SET from above, we don't want to check
860868
* for writing if we are still connecting, unless want_write is

libs/mosquitto/src/mosquitto.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extern "C" {
4545

4646
#define LIBMOSQUITTO_MAJOR 1
4747
#define LIBMOSQUITTO_MINOR 4
48-
#define LIBMOSQUITTO_REVISION 4
48+
#define LIBMOSQUITTO_REVISION 8
4949
/* LIBMOSQUITTO_VERSION_NUMBER looks like 1002001 for e.g. version 1.2.1. */
5050
#define LIBMOSQUITTO_VERSION_NUMBER (LIBMOSQUITTO_MAJOR*1000000+LIBMOSQUITTO_MINOR*1000+LIBMOSQUITTO_REVISION)
5151

@@ -576,6 +576,7 @@ libmosq_EXPORT int mosquitto_disconnect(struct mosquitto *mosq);
576576
* Note that although the MQTT protocol doesn't use message ids
577577
* for messages with QoS=0, libmosquitto assigns them message ids
578578
* so they can be tracked with this parameter.
579+
* topic - null terminated string of the topic to publish to.
579580
* payloadlen - the size of the payload (bytes). Valid values are between 0 and
580581
* 268,435,455.
581582
* payload - pointer to the data to send. If payloadlen > 0 this must be a

libs/mosquitto/src/mosquitto_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,12 @@ struct mosquitto {
207207
int sub_count;
208208
int pollfd_index;
209209
# ifdef WITH_WEBSOCKETS
210+
# if defined(LWS_LIBRARY_VERSION_NUMBER)
211+
struct lws *wsi;
212+
# else
210213
struct libwebsocket_context *ws_context;
211214
struct libwebsocket *wsi;
215+
# endif
212216
# endif
213217
#else
214218
# ifdef WITH_SOCKS

libs/mosquitto/src/net_mosq.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ ssize_t _mosquitto_net_write(struct mosquitto *mosq, void *buf, size_t count)
712712
errno = 0;
713713
#ifdef WITH_TLS
714714
if(mosq->ssl){
715+
mosq->want_write = false;
715716
ret = SSL_write(mosq->ssl, buf, count);
716717
if(ret < 0){
717718
err = SSL_get_error(mosq->ssl, ret);
@@ -1125,10 +1126,6 @@ int _mosquitto_socketpair(mosq_sock_t *pairR, mosq_sock_t *pairW)
11251126
continue;
11261127
}
11271128

1128-
if(_mosquitto_socket_nonblock(listensock)){
1129-
continue;
1130-
}
1131-
11321129
if(family[i] == AF_INET){
11331130
sa->sin_family = family[i];
11341131
sa->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
@@ -1145,6 +1142,7 @@ int _mosquitto_socketpair(mosq_sock_t *pairR, mosq_sock_t *pairW)
11451142
continue;
11461143
}
11471144
if(_mosquitto_socket_nonblock(spR)){
1145+
COMPAT_CLOSE(spR);
11481146
COMPAT_CLOSE(listensock);
11491147
continue;
11501148
}
@@ -1172,6 +1170,7 @@ int _mosquitto_socketpair(mosq_sock_t *pairR, mosq_sock_t *pairW)
11721170

11731171
if(_mosquitto_socket_nonblock(spW)){
11741172
COMPAT_CLOSE(spR);
1173+
COMPAT_CLOSE(spW);
11751174
COMPAT_CLOSE(listensock);
11761175
continue;
11771176
}

0 commit comments

Comments
 (0)