summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-05-02 23:45:10 +0200
committerattilamolnar <attilamolnar@hush.com>2013-05-02 23:45:10 +0200
commitdc4c8c85f383567aef9325a08515c9890bd89ab8 (patch)
tree363c59b199bf4440bce343ff1c73d5f20332a4c7
parent52386bed51b481f9779ef3525f7c09a10a7e49cf (diff)
m_ssl_gnutls Call gnutls_transport_set_errno() on Windows only
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index e3f9cd566..41e9d0c3d 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -180,11 +180,17 @@ class ModuleSSLGnuTLS : public Module
issl_session* session = reinterpret_cast<issl_session*>(session_wrap);
if (session->socket->GetEventMask() & FD_READ_WILL_BLOCK)
{
+#ifdef _WIN32
gnutls_transport_set_errno(session->sess, EAGAIN);
+#else
+ errno = EAGAIN;
+#endif
return -1;
}
int rv = ServerInstance->SE->Recv(session->socket, reinterpret_cast<char *>(buffer), size, 0);
+
+#ifdef _WIN32
if (rv < 0)
{
/* Windows doesn't use errno, but gnutls does, so check SocketEngine::IgnoreError()
@@ -194,6 +200,7 @@ class ModuleSSLGnuTLS : public Module
*/
gnutls_transport_set_errno(session->sess, SocketEngine::IgnoreError() ? EAGAIN : errno);
}
+#endif
if (rv < (int)size)
ServerInstance->SE->ChangeEventMask(session->socket, FD_READ_WILL_BLOCK);
@@ -205,11 +212,17 @@ class ModuleSSLGnuTLS : public Module
issl_session* session = reinterpret_cast<issl_session*>(session_wrap);
if (session->socket->GetEventMask() & FD_WRITE_WILL_BLOCK)
{
+#ifdef _WIN32
gnutls_transport_set_errno(session->sess, EAGAIN);
+#else
+ errno = EAGAIN;
+#endif
return -1;
}
int rv = ServerInstance->SE->Send(session->socket, reinterpret_cast<const char *>(buffer), size, 0);
+
+#ifdef _WIN32
if (rv < 0)
{
/* Windows doesn't use errno, but gnutls does, so check SocketEngine::IgnoreError()
@@ -219,6 +232,7 @@ class ModuleSSLGnuTLS : public Module
*/
gnutls_transport_set_errno(session->sess, SocketEngine::IgnoreError() ? EAGAIN : errno);
}
+#endif
if (rv < (int)size)
ServerInstance->SE->ChangeEventMask(session->socket, FD_WRITE_WILL_BLOCK);