diff options
author | Kari Oikarinen <kari.oikarinen@qt.io> | 2017-02-22 13:31:13 +0200 |
---|---|---|
committer | Kari Oikarinen <kari.oikarinen@qt.io> | 2017-03-24 13:59:47 +0000 |
commit | b43f96f322abe956d0864694af3e8c1bf9e1d7dc (patch) | |
tree | 6d2c1208b5b20740cf987e825213c11853f5e3ce | |
parent | edddfe21e16c80f499007de10fbd5abb3729ca9d (diff) |
Close streams when resetting Connection
The streams were only destroyed, not closed. This meant that ongoing
Services would have a dangling pointer.
Also only reset the connection once in response to Invalid messages.
Change-Id: I35ccb149986a76ee9abf9182923ee40bd5174373
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
-rw-r--r-- | qdb/server/connection.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/qdb/server/connection.cpp b/qdb/server/connection.cpp index 03f2693..2b13666 100644 --- a/qdb/server/connection.cpp +++ b/qdb/server/connection.cpp @@ -116,7 +116,8 @@ void Connection::handleMessage() if (message.command() == QdbMessage::Invalid) { qCCritical(connectionC) << "Connection received invalid message!"; - resetConnection(false); + if (m_state != ConnectionState::Disconnected) + resetConnection(false); return; } @@ -276,6 +277,10 @@ void Connection::resetConnection(bool reconnect) m_outgoingMessages.clear(); m_state = ConnectionState::Disconnected; m_streamRequests.clear(); + for (const auto &pair : m_streams) { + const auto &stream = pair.second; + stream->close(); + } m_streams.clear(); if (reconnect) |