Do not segfault when trying to send TLS data over a not-yet connected socket

This commit is contained in:
Florent Le Coz
2015-11-30 03:23:42 +01:00
parent 0620c8e589
commit 296a16fa75
+3 -1
View File
@@ -410,7 +410,9 @@ void TCPSocketHandler::tls_recv()
void TCPSocketHandler::tls_send(std::string&& data) void TCPSocketHandler::tls_send(std::string&& data)
{ {
if (this->tls->is_active()) // We may not be connected yet, or the tls session has
// not yet been negociated
if (this->tls && this->tls->is_active())
{ {
const bool was_active = this->tls->is_active(); const bool was_active = this->tls->is_active();
if (!this->pre_buf.empty()) if (!this->pre_buf.empty())