From 3f97fe394b38ffc0d8374965cd301f78383f9dde Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 5 Aug 2007 13:51:33 +0000 Subject: 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 --- src/modules/extra/m_ssl_gnutls.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/modules') 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) -- cgit v1.2.3