summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-22 19:36:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-22 19:36:16 +0000
commit70f57afea5e3b3e9a3b58a2f9397b84a6647a167 (patch)
treea2faa0ce92b371cd4c715619b3f1fcdd3b20a05e /src/modules/extra
parent5592a5c930217667653919fb39e451d7e9866991 (diff)
EAGAIN fixes for gnutls
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6698 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index ec6680d24..5896f812b 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -383,6 +383,7 @@ class ModuleSSLGnuTLS : public Module
virtual void OnRawSocketClose(int fd)
{
+ ServerInstance->Log(DEBUG,"Close 3");
CloseSession(&sessions[fd]);
EventHandler* user = ServerInstance->SE->GetRef(fd);
@@ -403,6 +404,7 @@ class ModuleSSLGnuTLS : public Module
if (!session->sess)
{
readresult = 0;
+ ServerInstance->Log(DEBUG,"Close 4");
CloseSession(session);
return 1;
}
@@ -419,6 +421,7 @@ class ModuleSSLGnuTLS : public Module
}
else if (session->status == ISSL_HANDSHAKING_WRITE)
{
+ errno = EAGAIN;
return -1;
}
@@ -434,6 +437,7 @@ class ModuleSSLGnuTLS : public Module
{
// Client closed connection.
readresult = 0;
+ ServerInstance->Log(DEBUG,"Close 5");
CloseSession(session);
return 1;
}
@@ -447,6 +451,7 @@ class ModuleSSLGnuTLS : public Module
else
{
readresult = 0;
+ ServerInstance->Log(DEBUG,"Close 6");
CloseSession(session);
}
}
@@ -495,6 +500,7 @@ class ModuleSSLGnuTLS : public Module
if (!session->sess)
{
+ ServerInstance->Log(DEBUG,"Close 7");
CloseSession(session);
return 1;
}
@@ -508,7 +514,7 @@ class ModuleSSLGnuTLS : public Module
// The handshake isn't finished, try to finish it.
Handshake(session);
errno = EAGAIN;
- return 0;
+ return -1;
}
int ret = 0;
@@ -518,11 +524,22 @@ class ModuleSSLGnuTLS : public Module
ret = gnutls_record_send(session->sess, sendbuffer, count);
if(ret == 0)
+ {
+ ServerInstance->Log(DEBUG,"Close 1");
CloseSession(session);
- else if(ret < 0)
+ }
+ else if (ret < 0)
{
if(ret != GNUTLS_E_AGAIN && ret != GNUTLS_E_INTERRUPTED)
+ {
+ ServerInstance->Log(DEBUG,"Close 7");
CloseSession(session);
+ }
+ else
+ {
+ errno = EAGAIN;
+ return -1;
+ }
}
else
{
@@ -603,6 +620,7 @@ class ModuleSSLGnuTLS : public Module
else
{
// Handshake failed.
+ ServerInstance->Log(DEBUG,"Close 2");
CloseSession(session);
session->status = ISSL_CLOSING;
}