packaging/flatpak/org.videolan.VLC/live555-nosignal.patch

106 lines
4.3 KiB
Diff

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