mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-09 01:01:11 +08:00
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.
|
||||
- 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.
|
||||
- Don't set SIGPIPE to ignore, use MSG_NOSIGNAL instead. Closes #2564.
|
||||
|
||||
Clients:
|
||||
- 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;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
mosq = (struct mosquitto *)mosquitto__calloc(1, sizeof(struct mosquitto));
|
||||
if(mosq){
|
||||
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 */
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
return write(mosq->sock, buf, count);
|
||||
#else
|
||||
return send(mosq->sock, buf, count, 0);
|
||||
#endif
|
||||
return send(mosq->sock, buf, count, MSG_NOSIGNAL);
|
||||
|
||||
#ifdef WITH_TLS
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ Contributors:
|
||||
#define NET_MOSQ_H
|
||||
|
||||
#ifndef WIN32
|
||||
# include <sys/socket.h>
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# include <winsock2.h>
|
||||
@ -51,6 +52,10 @@ typedef SSIZE_T ssize_t;
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
|
||||
#ifndef MSG_NOSIGNAL
|
||||
# define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
/* Macros for accessing the MSB and LSB of a uint16_t */
|
||||
#define MOSQ_MSB(A) (uint8_t)((A & 0xFF00) >> 8)
|
||||
#define MOSQ_LSB(A) (uint8_t)(A & 0x00FF)
|
||||
|
Loading…
x
Reference in New Issue
Block a user