Just ignore SIGPIPE, MSG_NOSIGNAL is Linux-specific
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 22 Nov 2009 22:08:35 +0000 (22:08 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 22 Nov 2009 22:08:35 +0000 (22:08 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump@56 400ebc74-4327-4243-bc38-086b20814532

streams.cpp

index 34158b4..0cbef98 100644 (file)
@@ -661,7 +661,7 @@ void processTCPrequest
                // write FLV header first
                nRead = WriteHeader(&buffer, PACKET_SIZE);
                if(nRead > 0) {
-                       nWritten = send(sockfd, buffer, nRead, MSG_NOSIGNAL);
+                       nWritten = send(sockfd, buffer, nRead, 0);
                         if(nWritten < 0) {
                                Log(LOGERROR, "%s, sending failed, error: %d", __FUNCTION__, GetSockError());
                                 goto cleanup; // we are in STREAMING_IN_PROGRESS, so we'll go to STREAMING_ACCEPTING    
@@ -680,7 +680,7 @@ void processTCPrequest
 
                        if(nRead > 0)
                        {
-                               nWritten = send(sockfd, buffer, nRead, MSG_NOSIGNAL);
+                               nWritten = send(sockfd, buffer, nRead, 0);
                                //Log(LOGDEBUG, "written: %d", nWritten);
                                if(nWritten < 0) {
                                        Log(LOGERROR, "%s, sending failed, error: %d", __FUNCTION__, GetSockError());
@@ -1025,6 +1025,7 @@ int main(int argc, char **argv)
        };
 
        signal(SIGINT, sigIntHandler);
+       signal(SIGPIPE, SIG_IGN);
 
        while((opt = getopt_long(argc, argv, "hvqVzr:s:t:p:a:f:u:n:c:l:y:m:d:D:A:B:g:w:x:", longopts, NULL)) != -1) {
                switch(opt) {