workaround added for applications that don't catch SIGEPIPE
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@75 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
d19a57c866
commit
16637892e3
@ -53,6 +53,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "unixutil.h"
|
#include "unixutil.h"
|
||||||
|
|
||||||
|
#ifndef MSG_NOSIGNAL
|
||||||
|
#define MSG_NOSIGNAL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : sock_init
|
* Function : sock_init
|
||||||
*
|
*
|
||||||
@ -229,7 +233,7 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
|
|
||||||
if( bRead ) {
|
if( bRead ) {
|
||||||
// read data
|
// read data
|
||||||
numBytes = recv( sockfd, buffer, bufsize,0); // MSG_NOSIGNAL is not a good idea in portable code, here SIGPIPE/SIGEPIPE has to be used instead
|
numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL);
|
||||||
} else {
|
} else {
|
||||||
byte_left = bufsize;
|
byte_left = bufsize;
|
||||||
bytes_sent = 0;
|
bytes_sent = 0;
|
||||||
@ -237,7 +241,7 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
// write data
|
// write data
|
||||||
num_written =
|
num_written =
|
||||||
send( sockfd, buffer + bytes_sent, byte_left,
|
send( sockfd, buffer + bytes_sent, byte_left,
|
||||||
MSG_DONTROUTE); // | MSG_NOSIGNAL is not a good idea in portable code, here SIGPIPE/SIGEPIPE has to be used instead
|
MSG_DONTROUTE|MSG_NOSIGNAL);
|
||||||
if( num_written == -1 ) {
|
if( num_written == -1 ) {
|
||||||
return num_written;
|
return num_written;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user