diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-26 17:59:45 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-26 17:59:45 -0700 |
| commit | 2ac56fd120c3c9dd924fccc169beed2d51658ba9 (patch) | |
| tree | bb17861516a42791f2f3545abc3871d59e53d3da /node/TcpSocket.cpp | |
| parent | e6b23059aca4947c8c4638c5d5e0abdba3b2b7b7 (diff) | |
| download | infinitytier-2ac56fd120c3c9dd924fccc169beed2d51658ba9.tar.gz infinitytier-2ac56fd120c3c9dd924fccc169beed2d51658ba9.zip | |
Fix TCP connection accumulation problem, still having issues with TCP tunneling.
Diffstat (limited to 'node/TcpSocket.cpp')
| -rw-r--r-- | node/TcpSocket.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/node/TcpSocket.cpp b/node/TcpSocket.cpp index a422dec6..b56775d8 100644 --- a/node/TcpSocket.cpp +++ b/node/TcpSocket.cpp @@ -164,32 +164,22 @@ bool TcpSocket::notifyAvailableForWrite(const SharedPtr<Socket> &self,SocketMana if (_outptr) { int n = (int)::send(_sock,(const char *)_outbuf,_outptr,0); - if (n < 0) { + if (n <= 0) { switch(errno) { -#ifdef EBADF - case EBADF: +#ifdef EAGAIN + case EAGAIN: #endif -#ifdef EINVAL - case EINVAL: +#if defined(EWOULDBLOCK) && ( !defined(EAGAIN) || (EWOULDBLOCK != EAGAIN) ) + case EWOULDBLOCK: #endif -#ifdef ENOTSOCK - case ENOTSOCK: +#ifdef EINTR + case EINTR: #endif -#ifdef ECONNRESET - case ECONNRESET: -#endif -#ifdef EPIPE - case EPIPE: -#endif -#ifdef ENETDOWN - case ENETDOWN: -#endif - return false; - default: break; + default: + return false; } - } else if (n > 0) - memmove(_outbuf,_outbuf + (unsigned int)n,_outptr -= (unsigned int)n); + } else memmove(_outbuf,_outbuf + (unsigned int)n,_outptr -= (unsigned int)n); } if (!_outptr) |
