fix crash on port scan

This commit is contained in:
badaix 2017-10-09 18:35:19 +02:00
parent a490402721
commit b1edc34f6e
4 changed files with 47 additions and 30 deletions

View file

@ -10,11 +10,13 @@ snapclient (0.12.0) unstable; urgency=low
-Snapserver: fix config file permissions (Issue #251)
-Fix linker error (Issue #255, #274)
-Snapserver: fix crash on "bye" from control client (Issue #238)
-Snapserver: fix crash on port scan (Issue #267)
* General
-Improved logging: Use "--debug" for debug logging
-Log to file: Use "--debug=<filename>"
-Improved exception handling and error logging (Issue #276)
-Android: update to NDK r16 and clang++
-hide spotify credentials in json control message (Issue #282)
-- Johannes Pohl <johannes.pohl@badaix.de> Tue, 04 Oct 2017 00:13:37 +0200

View file

@ -109,12 +109,14 @@ void ControlServer::startAccept()
void ControlServer::handleAccept(socket_ptr socket)
{
try
{
struct timeval tv;
tv.tv_sec = 5;
tv.tv_usec = 0;
setsockopt(socket->native_handle(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(socket->native_handle(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
// socket->set_option(boost::asio::ip::tcp::no_delay(false));
// socket->set_option(boost::asio::ip::tcp::no_delay(false));
SLOG(NOTICE) << "ControlServer::NewConnection: " << socket->remote_endpoint().address().to_string() << endl;
shared_ptr<ControlSession> session = make_shared<ControlSession>(this, socket);
{
@ -123,6 +125,11 @@ void ControlServer::handleAccept(socket_ptr socket)
sessions_.insert(session);
cleanup();
}
}
catch (const std::exception& e)
{
SLOG(ERROR) << "Exception in ControlServer::handleAccept: " << e.what() << endl;
}
startAccept();
}

View file

@ -10,11 +10,13 @@ snapserver (0.12.0) unstable; urgency=low
-Snapserver: fix config file permissions (Issue #251)
-Fix linker error (Issue #255, #274)
-Snapserver: fix crash on "bye" from control client (Issue #238)
-Snapserver: fix crash on port scan (Issue #267)
* General
-Improved logging: Use "--debug" for debug logging
-Log to file: Use "--debug=<filename>"
-Improved exception handling and error logging (Issue #276)
-Android: update to NDK r16 and clang++
-hide spotify credentials in json control message (Issue #282)
-- Johannes Pohl <johannes.pohl@badaix.de> Tue, 04 Oct 2017 00:13:37 +0200

View file

@ -576,6 +576,8 @@ void StreamServer::startAccept()
void StreamServer::handleAccept(socket_ptr socket)
{
try
{
struct timeval tv;
tv.tv_sec = 5;
tv.tv_usec = 0;
@ -593,7 +595,11 @@ void StreamServer::handleAccept(socket_ptr socket)
std::lock_guard<std::recursive_mutex> mlock(sessionsMutex_);
sessions_.insert(session);
}
catch (const std::exception& e)
{
SLOG(ERROR) << "Exception in StreamServer::handleAccept: " << e.what() << endl;
}
startAccept();
}