diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-22 13:12:02 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-22 13:12:02 +0200 |
commit | ecf5bd3c4fd8557b06c6849b317d8d3ccaca528f (patch) | |
tree | 6d7d038b6d705356040e8b1f331c075f90b7c690 /common/listener.cpp | |
parent | 6864e4accaafa4fa90332719bff5a85a0e92b242 (diff) | |
download | sink-ecf5bd3c4fd8557b06c6849b317d8d3ccaca528f.tar.gz sink-ecf5bd3c4fd8557b06c6849b317d8d3ccaca528f.zip |
A better crashhandler that notifies the client of the crash.
Diffstat (limited to 'common/listener.cpp')
-rw-r--r-- | common/listener.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/listener.cpp b/common/listener.cpp index 28748e5..de20b2c 100644 --- a/common/listener.cpp +++ b/common/listener.cpp | |||
@@ -87,6 +87,23 @@ Listener::~Listener() | |||
87 | { | 87 | { |
88 | } | 88 | } |
89 | 89 | ||
90 | void Listener::emergencyAbortAllConnections() | ||
91 | { | ||
92 | for (Client &client : m_connections) { | ||
93 | if (client.socket) { | ||
94 | Warning() << "Sending panic"; | ||
95 | client.socket->write("PANIC"); | ||
96 | client.socket->waitForBytesWritten(); | ||
97 | disconnect(client.socket, 0, this, 0); | ||
98 | client.socket->abort(); | ||
99 | delete client.socket; | ||
100 | client.socket = 0; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | m_connections.clear(); | ||
105 | } | ||
106 | |||
90 | void Listener::closeAllConnections() | 107 | void Listener::closeAllConnections() |
91 | { | 108 | { |
92 | for (Client &client : m_connections) { | 109 | for (Client &client : m_connections) { |