]> jfr.im git - irc/kvirc/KVIrc.git/commitdiff
KviSSL: Check SSL_in_init before SSL_shutdown
authorIceN9ne <redacted>
Wed, 26 Jun 2019 02:58:32 +0000 (22:58 -0400)
committerIceN9ne <redacted>
Wed, 26 Jun 2019 02:58:32 +0000 (22:58 -0400)
src/kvilib/net/KviSSL.cpp

index 8662b2f98f0676eda26646e031a5eaee8600ac47..1ff7e7b4f67e41e1d321feec5bad09885a5eb953 100644 (file)
@@ -329,12 +329,14 @@ void KviSSL::shutdown()
                // ignore SIGPIPE
                signal(SIGPIPE, SIG_IGN);
                // At least attempt to shutdown the connection gracefully
-               SSL_shutdown(m_pSSL);
+               if(!SSL_in_init(m_pSSL))
+                       SSL_shutdown(m_pSSL);
                //restore normal SIGPIPE behaviour.
                signal(SIGPIPE, SIG_DFL);
 #else
                // At least attempt to shutdown the connection gracefully
-               SSL_shutdown(m_pSSL);
+               if(!SSL_in_init(m_pSSL))
+                       SSL_shutdown(m_pSSL);
 #endif
                SSL_free(m_pSSL);
                m_pSSL = nullptr;