-
Notifications
You must be signed in to change notification settings - Fork 22
/
live555-nosignal.patch
105 lines (95 loc) · 4.32 KB
/
live555-nosignal.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
diff --git a/groupsock/GroupsockHelper.cpp b/groupsock/GroupsockHelper.cpp
index 1ddf91f..2007e3e 100644
--- a/groupsock/GroupsockHelper.cpp
+++ b/groupsock/GroupsockHelper.cpp
@@ -44,6 +44,10 @@ extern "C" int initializeWinsockIfNecessary();
#endif
#include <stdio.h>
+#ifndef MSG_NOSIGNAL
+# define MSG_NOSIGNAL 0
+#endif
+
// By default, use INADDR_ANY for the sending and receiving interfaces:
netAddressBits SendingInterfaceAddr = INADDR_ANY;
netAddressBits ReceivingInterfaceAddr = INADDR_ANY;
@@ -399,7 +403,7 @@ Boolean writeSocket(UsageEnvironment& env,
unsigned char* buffer, unsigned bufferSize) {
do {
MAKE_SOCKADDR_IN(dest, address.s_addr, portNum);
- int bytesSent = sendto(socket, (char*)buffer, bufferSize, 0,
+ int bytesSent = sendto(socket, (char*)buffer, bufferSize, MSG_NOSIGNAL,
(struct sockaddr*)&dest, sizeof dest);
if (bytesSent != (int)bufferSize) {
char tmpBuf[100];
diff --git a/liveMedia/RTPInterface.cpp b/liveMedia/RTPInterface.cpp
index 78b37d4..b042368 100644
--- a/liveMedia/RTPInterface.cpp
+++ b/liveMedia/RTPInterface.cpp
@@ -24,6 +24,10 @@ along with this library; if not, write to the Free Software Foundation, Inc.,
#include <GroupsockHelper.hh>
#include <stdio.h>
+#ifndef MSG_NOSIGNAL
+# define MSG_NOSIGNAL 0
+#endif
+
////////// Helper Functions - Definition //////////
// Helper routines and data structures, used to implement
@@ -363,7 +367,7 @@ Boolean RTPInterface::sendRTPorRTCPPacketOverTCP(u_int8_t* packet, unsigned pack
#endif
Boolean RTPInterface::sendDataOverTCP(int socketNum, u_int8_t const* data, unsigned dataSize, Boolean forceSendToSucceed) {
- int sendResult = send(socketNum, (char const*)data, dataSize, 0/*flags*/);
+ int sendResult = send(socketNum, (char const*)data, dataSize, MSG_NOSIGNAL/*flags*/);
if (sendResult < (int)dataSize) {
// The TCP send() failed - at least partially.
@@ -377,7 +381,7 @@ Boolean RTPInterface::sendDataOverTCP(int socketNum, u_int8_t const* data, unsig
fprintf(stderr, "sendDataOverTCP: resending %d-byte send (blocking)\n", numBytesRemainingToSend); fflush(stderr);
#endif
makeSocketBlocking(socketNum, RTPINTERFACE_BLOCKING_WRITE_TIMEOUT_MS);
- sendResult = send(socketNum, (char const*)(&data[numBytesSentSoFar]), numBytesRemainingToSend, 0/*flags*/);
+ sendResult = send(socketNum, (char const*)(&data[numBytesSentSoFar]), numBytesRemainingToSend, MSG_NOSIGNAL/*flags*/);
if ((unsigned)sendResult != numBytesRemainingToSend) {
// The blocking "send()" failed, or timed out. In either case, we assume that the
// TCP connection has failed (or is 'hanging' indefinitely), and we stop using it
diff --git a/liveMedia/RTSPClient.cpp b/liveMedia/RTSPClient.cpp
index f47acb5..c3529a7 100644
--- a/liveMedia/RTSPClient.cpp
+++ b/liveMedia/RTSPClient.cpp
@@ -25,6 +25,10 @@ along with this library; if not, write to the Free Software Foundation, Inc.,
#include <GroupsockHelper.hh>
#include "ourMD5.hh"
+#ifndef MSG_NOSIGNAL
+# define MSG_NOSIGNAL 0
+#endif
+
RTSPClient* RTSPClient::createNew(UsageEnvironment& env, char const* rtspURL,
int verbosityLevel,
char const* applicationName,
@@ -1969,7 +1973,7 @@ int RTSPClient::write(const char* data, unsigned count) {
if (fTLS.isNeeded) {
return fTLS.write(data, count);
} else {
- return send(fOutputSocketNum, data, count, 0);
+ return send(fOutputSocketNum, data, count, MSG_NOSIGNAL);
}
}
diff --git a/liveMedia/RTSPServer.cpp b/liveMedia/RTSPServer.cpp
index a6b1ca4..4884c86 100644
--- a/liveMedia/RTSPServer.cpp
+++ b/liveMedia/RTSPServer.cpp
@@ -24,6 +24,10 @@ along with this library; if not, write to the Free Software Foundation, Inc.,
#include "Base64.hh"
#include <GroupsockHelper.hh>
+#ifndef MSG_NOSIGNAL
+# define MSG_NOSIGNAL 0
+#endif
+
////////// RTSPServer implementation //////////
RTSPServer*
@@ -882,7 +886,7 @@ void RTSPServer::RTSPClientConnection::handleRequestBytes(int newBytesRead) {
#ifdef DEBUG
fprintf(stderr, "sending response: %s", fResponseBuffer);
#endif
- send(fClientOutputSocket, (char const*)fResponseBuffer, strlen((char*)fResponseBuffer), 0);
+ send(fClientOutputSocket, (char const*)fResponseBuffer, strlen((char*)fResponseBuffer), MSG_NOSIGNAL);
if (playAfterSetup) {
// The client has asked for streaming to commence now, rather than after a