Suppress sigpipe in sender thread.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <net/senderthread.h>
|
||||
#include <net/sendercallback.h>
|
||||
#include <net/socket_msg.h>
|
||||
#include <net/socket_helper.h>
|
||||
#include <cstring>
|
||||
|
||||
#include <core/boost/timers.hpp>
|
||||
@@ -27,7 +28,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define SEND_ERROR_TIMEOUT_MSEC 20000
|
||||
#define SEND_ERROR_TIMEOUT_MSEC 20000
|
||||
#define SEND_TIMEOUT_MSEC 10
|
||||
#define SEND_QUEUE_SIZE 1000
|
||||
#define SEND_LOW_PRIO_QUEUE_SIZE 50000
|
||||
|
||||
SenderThread::SenderThread(SenderCallback &cb)
|
||||
: m_tmpOutBufSize(0), m_callback(cb)
|
||||
@@ -193,7 +197,7 @@ SenderThread::Main()
|
||||
if (selectResult > 0) // send is possible
|
||||
{
|
||||
// send next chunk of data
|
||||
int bytesSent = send(tmpSocket, m_tmpOutBuf, m_tmpOutBufSize, 0);
|
||||
int bytesSent = send(tmpSocket, m_tmpOutBuf, m_tmpOutBufSize, SOCKET_SEND_FLAGS);
|
||||
|
||||
if (!IS_VALID_SEND(bytesSent))
|
||||
{
|
||||
|
||||
@@ -26,14 +26,12 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <csignal>
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool
|
||||
socket_startup()
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#define _SENDERTHREAD_H_
|
||||
|
||||
#include <core/thread.h>
|
||||
#include <net/socket_helper.h>
|
||||
#include <net/sessiondata.h>
|
||||
#include <net/netpacket.h>
|
||||
#include <net/sendercallback.h>
|
||||
@@ -31,9 +30,6 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#define SENDER_THREAD_TERMINATE_TIMEOUT THREAD_WAIT_INFINITE
|
||||
#define SEND_TIMEOUT_MSEC 10
|
||||
#define SEND_QUEUE_SIZE 1000
|
||||
#define SEND_LOW_PRIO_QUEUE_SIZE 50000
|
||||
|
||||
class SenderThread : public Thread
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define SOCKET_ERR_WOULDBLOCK WSAEWOULDBLOCK
|
||||
#define SOCKET_ERR_NOTCONN WSAENOTCONN
|
||||
#define SOCKET_ERR_NOTSOCK WSAENOTSOCK
|
||||
#define SOCKET_SEND_FLAGS 0
|
||||
|
||||
#ifndef IPV6_V6ONLY
|
||||
#define IPV6_V6ONLY 27
|
||||
@@ -62,6 +63,7 @@ typedef unsigned char u_char;
|
||||
#define SOCKET_ERR_WOULDBLOCK EINPROGRESS
|
||||
#define SOCKET_ERR_NOTCONN ENOTCONN
|
||||
#define SOCKET_ERR_NOTSOCK ENOTSOCK
|
||||
#define SOCKET_SEND_FLAGS MSG_NOSIGNAL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user