summaryrefslogtreecommitdiff
path: root/louloulibs/network
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-11-30 03:20:51 +0100
committerFlorent Le Coz <louiz@louiz.org>2015-11-30 03:23:42 +0100
commit296a16fa75da5900395a7cf70f63a6ff266ef0cc (patch)
tree069eb650a14bd5161386b0701a825fa25a71b816 /louloulibs/network
parent0620c8e589c713fa0f0d0f66a4c4d203e8f3f87f (diff)
downloadbiboumi-296a16fa75da5900395a7cf70f63a6ff266ef0cc.tar.gz
biboumi-296a16fa75da5900395a7cf70f63a6ff266ef0cc.tar.bz2
biboumi-296a16fa75da5900395a7cf70f63a6ff266ef0cc.tar.xz
biboumi-296a16fa75da5900395a7cf70f63a6ff266ef0cc.zip
Do not segfault when trying to send TLS data over a not-yet connected socket
Diffstat (limited to 'louloulibs/network')
-rw-r--r--louloulibs/network/tcp_socket_handler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/louloulibs/network/tcp_socket_handler.cpp b/louloulibs/network/tcp_socket_handler.cpp
index d5c0dfa..78efdce 100644
--- a/louloulibs/network/tcp_socket_handler.cpp
+++ b/louloulibs/network/tcp_socket_handler.cpp
@@ -410,7 +410,9 @@ void TCPSocketHandler::tls_recv()
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();
if (!this->pre_buf.empty())