PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/src/live555/live555-nosignal.patch

https://gitlab.com/evilbinary/vlc
Patch | 139 lines | 122 code | 17 blank | 0 comment | 0 complexity | 70e93a1a102ad2d3b14d2520eebd3462 MD5 | raw file
  1. Copyright (C) 2015 RĂ©mi Denis-Courmont
  2. Licensed under the terms of the GNU LGPL version 2.1 or later.
  3. diff -ru live555.orig/liveMedia/RTPInterface.cpp live555/liveMedia/RTPInterface.cpp
  4. --- live555.orig/liveMedia/RTPInterface.cpp 2015-05-21 20:34:45.855307019 +0300
  5. +++ live555/liveMedia/RTPInterface.cpp 2015-05-21 20:38:10.383305167 +0300
  6. @@ -23,6 +23,9 @@
  7. #include "RTPInterface.hh"
  8. #include <GroupsockHelper.hh>
  9. #include <stdio.h>
  10. +#ifndef MSG_NOSIGNAL
  11. +# define MSG_NOSIGNAL 0
  12. +#endif
  13. ////////// Helper Functions - Definition //////////
  14. @@ -339,7 +339,7 @@
  15. #endif
  16. Boolean RTPInterface::sendDataOverTCP(int socketNum, u_int8_t const* data, unsigned dataSize, Boolean forceSendToSucceed) {
  17. - int sendResult = send(socketNum, (char const*)data, dataSize, 0/*flags*/);
  18. + int sendResult = send(socketNum, (char const*)data, dataSize, MSG_NOSIGNAL);
  19. if (sendResult < (int)dataSize) {
  20. // The TCP send() failed - at least partially.
  21. @@ -353,7 +353,7 @@
  22. fprintf(stderr, "sendDataOverTCP: resending %d-byte send (blocking)\n", numBytesRemainingToSend); fflush(stderr);
  23. #endif
  24. makeSocketBlocking(socketNum, RTPINTERFACE_BLOCKING_WRITE_TIMEOUT_MS);
  25. - sendResult = send(socketNum, (char const*)(&data[numBytesSentSoFar]), numBytesRemainingToSend, 0/*flags*/);
  26. + sendResult = send(socketNum, (char const*)(&data[numBytesSentSoFar]), numBytesRemainingToSend, MSG_NOSIGNAL);
  27. if ((unsigned)sendResult != numBytesRemainingToSend) {
  28. // The blocking "send()" failed, or timed out. In either case, we assume that the
  29. // TCP connection has failed (or is 'hanging' indefinitely), and we stop using it
  30. diff -ru live555.orig/liveMedia/RTSPClient.cpp live555/liveMedia/RTSPClient.cpp
  31. --- live555.orig/liveMedia/RTSPClient.cpp 2015-05-21 20:34:45.855307019 +0300
  32. +++ live555/liveMedia/RTSPClient.cpp 2015-05-21 20:39:54.327304226 +0300
  33. @@ -24,6 +24,9 @@
  34. #include "Locale.hh"
  35. #include <GroupsockHelper.hh>
  36. #include "ourMD5.hh"
  37. +#ifndef MSG_NOSIGNAL
  38. +# define MSG_NOSIGNAL 0
  39. +#endif
  40. ////////// RTSPClient implementation //////////
  41. @@ -497,7 +500,7 @@
  42. delete[] origCmd;
  43. }
  44. - if (send(fOutputSocketNum, cmd, strlen(cmd), 0) < 0) {
  45. + if (send(fOutputSocketNum, cmd, strlen(cmd), MSG_NOSIGNAL) < 0) {
  46. char const* errFmt = "%s send() failed: ";
  47. unsigned const errLength = strlen(errFmt) + strlen(request->commandName());
  48. char* err = new char[errLength];
  49. @@ -939,7 +942,7 @@
  50. char tmpBuf[2*RTSP_PARAM_STRING_MAX];
  51. snprintf((char*)tmpBuf, sizeof tmpBuf,
  52. "RTSP/1.0 405 Method Not Allowed\r\nCSeq: %s\r\n\r\n", cseq);
  53. - send(fOutputSocketNum, tmpBuf, strlen(tmpBuf), 0);
  54. + send(fOutputSocketNum, tmpBuf, strlen(tmpBuf), MSG_NOSIGNAL);
  55. }
  56. }
  57. diff -ru live555.orig/liveMedia/RTSPServerSupportingHTTPStreaming.cpp live555/liveMedia/RTSPServerSupportingHTTPStreaming.cpp
  58. --- live555.orig/liveMedia/RTSPServerSupportingHTTPStreaming.cpp 2015-05-21 20:34:45.857307019 +0300
  59. +++ live555/liveMedia/RTSPServerSupportingHTTPStreaming.cpp 2015-05-21 20:39:44.568304314 +0300
  60. @@ -24,6 +24,9 @@
  61. #include <sys/stat.h>
  62. #endif
  63. #include <time.h>
  64. +#ifndef MSG_NOSIGNAL
  65. +# define MSG_NOSIGNAL 0
  66. +#endif
  67. RTSPServerSupportingHTTPStreaming*
  68. RTSPServerSupportingHTTPStreaming::createNew(UsageEnvironment& env, Port rtspPort,
  69. @@ -140,7 +143,7 @@
  70. lastModifiedHeader(streamName),
  71. numTSBytesToStream);
  72. // Send the response now, because we're about to add more data (from the source):
  73. - send(fClientOutputSocket, (char const*)fResponseBuffer, strlen((char*)fResponseBuffer), 0);
  74. + send(fClientOutputSocket, (char const*)fResponseBuffer, strlen((char*)fResponseBuffer), MSG_NOSIGNAL);
  75. fResponseBuffer[0] = '\0'; // We've already sent the response. This tells the calling code not to send it again.
  76. // Ask the media source to deliver - to the TCP sink - the desired data:
  77. @@ -234,7 +237,7 @@
  78. playlistLen);
  79. // Send the response header now, because we're about to add more data (the playlist):
  80. - send(fClientOutputSocket, (char const*)fResponseBuffer, strlen((char*)fResponseBuffer), 0);
  81. + send(fClientOutputSocket, (char const*)fResponseBuffer, strlen((char*)fResponseBuffer), MSG_NOSIGNAL);
  82. fResponseBuffer[0] = '\0'; // We've already sent the response. This tells the calling code not to send it again.
  83. // Then, send the playlist. Because it's large, we don't do so using "send()", because that might not send it all at once.
  84. --- live/groupsock/GroupsockHelper.cpp.orig 2015-06-22 00:09:17.000000000 +0200
  85. +++ live/groupsock/GroupsockHelper.cpp 2015-06-22 10:56:08.673912904 +0200
  86. @@ -35,6 +35,9 @@
  87. #define USE_SIGNALS 1
  88. #endif
  89. #include <stdio.h>
  90. +#ifndef MSG_NOSIGNAL
  91. +# define MSG_NOSIGNAL 0
  92. +#endif
  93. // By default, use INADDR_ANY for the sending and receiving interfaces:
  94. netAddressBits SendingInterfaceAddr = INADDR_ANY;
  95. @@ -342,7 +345,7 @@
  96. unsigned char* buffer, unsigned bufferSize) {
  97. do {
  98. MAKE_SOCKADDR_IN(dest, address.s_addr, portNum);
  99. - int bytesSent = sendto(socket, (char*)buffer, bufferSize, 0,
  100. + int bytesSent = sendto(socket, (char*)buffer, bufferSize, MSG_NOSIGNAL,
  101. (struct sockaddr*)&dest, sizeof dest);
  102. if (bytesSent != (int)bufferSize) {
  103. char tmpBuf[100];
  104. --- live/liveMedia/TCPStreamSink.cpp.orig 2015-06-22 00:09:17.000000000 +0200
  105. +++ live/liveMedia/TCPStreamSink.cpp 2015-06-22 11:01:32.669268927 +0200
  106. @@ -20,6 +20,9 @@
  107. #include "TCPStreamSink.hh"
  108. #include <GroupsockHelper.hh> // for "ignoreSigPipeOnSocket()"
  109. +#ifndef MSG_NOSIGNAL
  110. +# define MSG_NOSIGNAL 0
  111. +#endif
  112. TCPStreamSink* TCPStreamSink::createNew(UsageEnvironment& env, int socketNum) {
  113. return new TCPStreamSink(env, socketNum);
  114. @@ -51,7 +54,7 @@
  115. // First, try writing data to our output socket, if we can:
  116. if (fOutputSocketIsWritable && numUnwrittenBytes() > 0) {
  117. int numBytesWritten
  118. - = send(fOutputSocketNum, (const char*)&fBuffer[fUnwrittenBytesStart], numUnwrittenBytes(), 0);
  119. + = send(fOutputSocketNum, (const char*)&fBuffer[fUnwrittenBytesStart], numUnwrittenBytes(), MSG_NOSIGNAL);
  120. if (numBytesWritten < (int)numUnwrittenBytes()) {
  121. // The output socket is no longer writable. Set a handler to be called when it becomes writable again.
  122. fOutputSocketIsWritable = False;