Don't set SIGPIPE to ignore, use MSG_NOSIGNAL instead.
Closes #2564. Thanks to nmeum.
This commit is contained in:
parent
8c0600c40c
commit
0c9d9f2163
@ -21,6 +21,7 @@ Client library:
|
|||||||
cmake version to 3.1, which is still ancient.
|
cmake version to 3.1, which is still ancient.
|
||||||
- Fix use of `MOSQ_OPT_TLS_ENGINE` being unable to be used due to the openssl
|
- Fix use of `MOSQ_OPT_TLS_ENGINE` being unable to be used due to the openssl
|
||||||
ctx not being initialised until starting to connect. Closes #2537.
|
ctx not being initialised until starting to connect. Closes #2537.
|
||||||
|
- Don't set SIGPIPE to ignore, use MSG_NOSIGNAL instead. Closes #2564.
|
||||||
|
|
||||||
Clients:
|
Clients:
|
||||||
- Fix mosquitto_pub incorrectly reusing topic aliases when reconnecting.
|
- Fix mosquitto_pub incorrectly reusing topic aliases when reconnecting.
|
||||||
|
@ -109,10 +109,6 @@ struct mosquitto *mosquitto_new(const char *id, bool clean_start, void *userdata
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mosq = (struct mosquitto *)mosquitto__calloc(1, sizeof(struct mosquitto));
|
mosq = (struct mosquitto *)mosquitto__calloc(1, sizeof(struct mosquitto));
|
||||||
if(mosq){
|
if(mosq){
|
||||||
mosq->sock = INVALID_SOCKET;
|
mosq->sock = INVALID_SOCKET;
|
||||||
|
@ -1041,11 +1041,7 @@ ssize_t net__write(struct mosquitto *mosq, const void *buf, size_t count)
|
|||||||
/* Call normal write/send */
|
/* Call normal write/send */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
return send(mosq->sock, buf, count, MSG_NOSIGNAL);
|
||||||
return write(mosq->sock, buf, count);
|
|
||||||
#else
|
|
||||||
return send(mosq->sock, buf, count, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_TLS
|
#ifdef WITH_TLS
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ Contributors:
|
|||||||
#define NET_MOSQ_H
|
#define NET_MOSQ_H
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
# include <sys/socket.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#else
|
#else
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@ -51,6 +52,10 @@ typedef SSIZE_T ssize_t;
|
|||||||
#define INVALID_SOCKET -1
|
#define INVALID_SOCKET -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MSG_NOSIGNAL
|
||||||
|
# define MSG_NOSIGNAL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Macros for accessing the MSB and LSB of a uint16_t */
|
/* Macros for accessing the MSB and LSB of a uint16_t */
|
||||||
#define MOSQ_MSB(A) (uint8_t)((A & 0xFF00) >> 8)
|
#define MOSQ_MSB(A) (uint8_t)((A & 0xFF00) >> 8)
|
||||||
#define MOSQ_LSB(A) (uint8_t)(A & 0x00FF)
|
#define MOSQ_LSB(A) (uint8_t)(A & 0x00FF)
|
||||||
|
Loading…
Reference in New Issue
Block a user