From dc4c8c85f383567aef9325a08515c9890bd89ab8 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Thu, 2 May 2013 23:45:10 +0200 Subject: m_ssl_gnutls Call gnutls_transport_set_errno() on Windows only --- src/modules/extra/m_ssl_gnutls.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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(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(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(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(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); -- cgit v1.2.3