mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
rtsp: avoid crashing on SIGPIPE
Use send() instead of write() so that we can pass the MSG_NOSIGNAL flags to avoid crashing with SIGPIPE when the remote end is not listening to us anymore. Fixes #601772
This commit is contained in:
parent
18f5fad785
commit
f3b3dd33f3
1 changed files with 8 additions and 2 deletions
|
@ -114,9 +114,15 @@ typedef struct
|
|||
guint coutl;
|
||||
} DecodeCtx;
|
||||
|
||||
#ifdef MSG_NOSIGNAL
|
||||
#define SEND_FLAGS MSG_NOSIGNAL
|
||||
#else
|
||||
#define SEND_FLAGS 0
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define READ_SOCKET(fd, buf, len) recv (fd, (char *)buf, len, 0)
|
||||
#define WRITE_SOCKET(fd, buf, len) send (fd, (const char *)buf, len, 0)
|
||||
#define WRITE_SOCKET(fd, buf, len) send (fd, (const char *)buf, len, SEND_FLAGS)
|
||||
#define SETSOCKOPT(sock, level, name, val, len) setsockopt (sock, level, name, (const char *)val, len)
|
||||
#define CLOSE_SOCKET(sock) closesocket (sock)
|
||||
#define ERRNO_IS_EAGAIN (WSAGetLastError () == WSAEWOULDBLOCK)
|
||||
|
@ -126,7 +132,7 @@ typedef struct
|
|||
#define ERRNO_IS_EINPROGRESS (WSAGetLastError () == WSAEWOULDBLOCK)
|
||||
#else
|
||||
#define READ_SOCKET(fd, buf, len) read (fd, buf, len)
|
||||
#define WRITE_SOCKET(fd, buf, len) write (fd, buf, len)
|
||||
#define WRITE_SOCKET(fd, buf, len) send (fd, buf, len, SEND_FLAGS)
|
||||
#define SETSOCKOPT(sock, level, name, val, len) setsockopt (sock, level, name, val, len)
|
||||
#define CLOSE_SOCKET(sock) close (sock)
|
||||
#define ERRNO_IS_EAGAIN (errno == EAGAIN)
|
||||
|
|
Loading…
Reference in a new issue