]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_ssl_gnutls, m_ssl_openssl After a read schedule another read if data remains in...
authorAttila Molnar <attilamolnar@hush.com>
Tue, 21 Jun 2016 13:07:43 +0000 (15:07 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Tue, 21 Jun 2016 13:07:43 +0000 (15:07 +0200)
src/modules/extra/m_ssl_gnutls.cpp
src/modules/extra/m_ssl_openssl.cpp

index 813a8ecfaa98990698339c32ac17ff15dd660ffa..2f4acf3f05edbb14454642940bf70fa37ae2759a 100644 (file)
@@ -703,6 +703,9 @@ class ModuleSSLGnuTLS : public Module
                        if (ret > 0)
                        {
                                recvq.append(buffer, ret);
+                               // Schedule a read if there is still data in the GnuTLS buffer
+                               if (gnutls_record_check_pending(session->sess) > 0)
+                                       ServerInstance->SE->ChangeEventMask(user, FD_ADD_TRIAL_READ);
                                return 1;
                        }
                        else if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
index b21091d3fddc6f2b6c5ca53bdd26ebd3a0b95c70..9e6472ac36582c7c934029bf7f189ed1e32f8a9d 100644 (file)
@@ -591,8 +591,15 @@ class ModuleSSLOpenSSL : public Module
                        if (ret > 0)
                        {
                                recvq.append(buffer, ret);
+
+                               int mask = 0;
+                               // Schedule a read if there is still data in the OpenSSL buffer
+                               if (SSL_pending(session->sess) > 0)
+                                       mask |= FD_ADD_TRIAL_READ;
                                if (session->data_to_write)
-                                       ServerInstance->SE->ChangeEventMask(user, FD_WANT_POLL_READ | FD_WANT_SINGLE_WRITE);
+                                       mask |= FD_WANT_POLL_READ | FD_WANT_SINGLE_WRITE;
+                               if (mask != 0)
+                                       ServerInstance->SE->ChangeEventMask(user, mask);
                                return 1;
                        }
                        else if (ret == 0)