diff --git a/src/lib/net/TCPSocket.cpp b/src/lib/net/TCPSocket.cpp index 91655ae3..0be5876b 100644 --- a/src/lib/net/TCPSocket.cpp +++ b/src/lib/net/TCPSocket.cpp @@ -496,7 +496,7 @@ TCPSocket::serviceConnected(ISocketMultiplexerJob* job, } else if (status == 0) { s_retryOutputBufferSize = buffSize; - return job; + return newJob(); } } else { @@ -559,7 +559,7 @@ TCPSocket::serviceConnected(ISocketMultiplexerJob* job, return NULL; } else if (status == 0) { - return job; + return newJob(); } } else { diff --git a/src/lib/net/TCPSocket.h b/src/lib/net/TCPSocket.h index c30a2d7e..b4c833ba 100644 --- a/src/lib/net/TCPSocket.h +++ b/src/lib/net/TCPSocket.h @@ -96,6 +96,10 @@ private: serviceConnected(ISocketMultiplexerJob*, bool, bool, bool); +protected: + bool m_readable; + bool m_writable; + private: Mutex m_mutex; ArchSocket m_socket; @@ -103,8 +107,6 @@ private: StreamBuffer m_outputBuffer; CondVar m_flushed; bool m_connected; - bool m_readable; - bool m_writable; IEventQueue* m_events; SocketMultiplexer* m_socketMultiplexer; }; diff --git a/src/lib/plugin/ns/SecureSocket.cpp b/src/lib/plugin/ns/SecureSocket.cpp index e3e88f06..6630388d 100644 --- a/src/lib/plugin/ns/SecureSocket.cpp +++ b/src/lib/plugin/ns/SecureSocket.cpp @@ -417,14 +417,21 @@ SecureSocket::checkResult(int status, int& retry) break; case SSL_ERROR_WANT_READ: + m_readable = true; + retry++; + LOG((CLOG_DEBUG2 "want to read, error=%d, attempt=%d", errorCode, retry)); + break; + case SSL_ERROR_WANT_WRITE: + m_writable = true; + retry++; + LOG((CLOG_DEBUG2 "want to write, error=%d, attempt=%d", errorCode, retry)); + break; + case SSL_ERROR_WANT_CONNECT: case SSL_ERROR_WANT_ACCEPT: - // it seems like these sort of errors are part of openssl's normal behavior, - // so we should expect a very high amount of these. sleeping doesn't seem to - // help... maybe you just have to swallow the errors (yuck). retry++; - LOG((CLOG_DEBUG2 "passive ssl error, error=%d, attempt=%d", errorCode, retry)); + LOG((CLOG_DEBUG2 "want to connect, error=%d, attempt=%d", errorCode, retry)); break; case SSL_ERROR_SYSCALL: