summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-05 13:51:33 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-05 13:51:33 +0000
commit3f97fe394b38ffc0d8374965cd301f78383f9dde (patch)
treeb9ad801aa13eb951ee79543360e73f57941b88af /src/modules
parent6edfe13e49a4dc49fb349f47c9dfff1c58d6e96f (diff)
Fixes from experiences on chatspike. Use the proper OnBufferFlushed event to decide when to write data, don't just recursively call OnRawSocketWrite when it fails (duhhhhhhh)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7659 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-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 357220b4e..bdeac9aa9 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -287,7 +287,7 @@ class ModuleSSLGnuTLS : public Module
void Implements(char* List)
{
List[I_On005Numeric] = List[I_OnRawSocketConnect] = List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = 1;
- List[I_OnRequest] = List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnPostConnect] = 1;
+ List[I_OnBufferFlushed] = List[I_OnRequest] = List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnPostConnect] = 1;
}
virtual void On005Numeric(std::string &output)
@@ -432,6 +432,7 @@ class ModuleSSLGnuTLS : public Module
else if (session->status == ISSL_HANDSHAKING_WRITE)
{
errno = EAGAIN;
+ MakePollWrite(session);
return -1;
}
@@ -556,6 +557,8 @@ class ModuleSSLGnuTLS : public Module
}
}
+ MakePollWrite(session);
+
/* Who's smart idea was it to return 1 when we havent written anything?
* This fucks the buffer up in InspSocket :p
*/
@@ -685,7 +688,22 @@ class ModuleSSLGnuTLS : public Module
void MakePollWrite(issl_session* session)
{
- OnRawSocketWrite(session->fd, NULL, 0);
+ //OnRawSocketWrite(session->fd, NULL, 0);
+ EventHandler* eh = ServerInstance->FindDescriptor(session->fd);
+ if (eh)
+ ServerInstance->SE->WantWrite(eh);
+ ServerInstance->Log(DEBUG, "Want write set");
+ }
+
+ virtual void OnBufferFlushed(userrec* user)
+ {
+ if (user->GetExt("ssl"))
+ {
+ ServerInstance->Log(DEBUG,"OnBufferFlushed for ssl user");
+ issl_session* session = &sessions[user->GetFd()];
+ if (session && session->outbuf.size())
+ OnRawSocketWrite(user->GetFd(), NULL, 0);
+ }
}
void CloseSession(issl_session* session)