From a6338c5fbf52e20e210e8a780bb6dc1bb45b343b Mon Sep 17 00:00:00 2001 From: Slavey Karadzhov Date: Wed, 8 Nov 2017 19:08:20 +0100 Subject: [PATCH] Only listening tcp's should be polled. Fixes segfault with HttpServer::shutdown(); --- Sming/SmingCore/Network/TcpConnection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sming/SmingCore/Network/TcpConnection.cpp b/Sming/SmingCore/Network/TcpConnection.cpp index f29399a53e..0f1b6b0874 100644 --- a/Sming/SmingCore/Network/TcpConnection.cpp +++ b/Sming/SmingCore/Network/TcpConnection.cpp @@ -309,7 +309,9 @@ void TcpConnection::close() axl_free(tcp); #endif - tcp_poll(tcp, staticOnPoll, 1); + if(tcp->state == LISTEN) { + tcp_poll(tcp, staticOnPoll, 1); + } tcp_arg(tcp, NULL); // reset pointer to close connection on next callback tcp = NULL;