summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-02-05 15:26:03 -0500
committerAdam <Adam@anope.org>2014-02-05 15:26:03 -0500
commit66cc965fd736a7785247a6c058c4bfacfe5ea02f (patch)
tree93f38cc6dc1d2e187d027a54b392d168b7626e1d /modules
parent2440514a7b53a43aa2efe8a0ef45f79d7a3710a8 (diff)
Ignore nonblocking errnors on socket operations
Diffstat (limited to 'modules')
-rw-r--r--modules/extra/m_ssl.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/modules/extra/m_ssl.cpp b/modules/extra/m_ssl.cpp
index 85b99d119..44971908c 100644
--- a/modules/extra/m_ssl.cpp
+++ b/modules/extra/m_ssl.cpp
@@ -190,14 +190,37 @@ SSLSocketIO::SSLSocketIO()
int SSLSocketIO::Recv(Socket *s, char *buf, size_t sz)
{
int i = SSL_read(this->sslsock, buf, sz);
- TotalRead += i;
+ if (i > 0)
+ TotalRead += i;
+ else if (i < 0)
+ {
+ int err = SSL_get_error(this->sslsock, i);
+ switch (err)
+ {
+ case SSL_ERROR_WANT_READ:
+ case SSL_ERROR_WANT_WRITE:
+ SocketEngine::SetLastError(EAGAIN);
+ }
+ }
+
return i;
}
int SSLSocketIO::Send(Socket *s, const char *buf, size_t sz)
{
int i = SSL_write(this->sslsock, buf, sz);
- TotalWritten += i;
+ if (i > 0)
+ TotalWritten += i;
+ else if (i < 0)
+ {
+ int err = SSL_get_error(this->sslsock, i);
+ switch (err)
+ {
+ case SSL_ERROR_WANT_READ:
+ case SSL_ERROR_WANT_WRITE:
+ SocketEngine::SetLastError(EAGAIN);
+ }
+ }
return i;
}