diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-21 18:47:22 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-23 17:37:53 +0200 |
commit | ab750adc8c98bc33784498b4d06c36798f52ff4b (patch) | |
tree | 1e2257c997c7059e42a21d32ac1745609728ae85 | |
parent | 4f18f360f8980adcb98d93fd95e94f0e95725070 (diff) | |
download | sink-ab750adc8c98bc33784498b4d06c36798f52ff4b.tar.gz sink-ab750adc8c98bc33784498b4d06c36798f52ff4b.zip |
Immediately close the socket after a shutdown notification.
Otherwise it can happen that the synchronizer receives the shutdown
command from a ResourceAccess instance, and while the synchronizer
waits for quit to be called, a new ResourceAccess instance already
connects to the synchronizer. That new connection will then of course
be unexpectedly killed once quit is called in the synchronizer.
-rw-r--r-- | synchronizer/listener.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/synchronizer/listener.cpp b/synchronizer/listener.cpp index 6c07809..1050da3 100644 --- a/synchronizer/listener.cpp +++ b/synchronizer/listener.cpp | |||
@@ -255,6 +255,8 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c | |||
255 | break; | 255 | break; |
256 | case Akonadi2::Commands::ShutdownCommand: | 256 | case Akonadi2::Commands::ShutdownCommand: |
257 | Log() << QString("\tReceived shutdown command from %1").arg(client.name); | 257 | Log() << QString("\tReceived shutdown command from %1").arg(client.name); |
258 | //Immediately reject new connections | ||
259 | m_server->close(); | ||
258 | QTimer::singleShot(0, this, &Listener::quit); | 260 | QTimer::singleShot(0, this, &Listener::quit); |
259 | break; | 261 | break; |
260 | default: | 262 | default: |
@@ -285,7 +287,7 @@ void Listener::quit() | |||
285 | } | 287 | } |
286 | m_fbb.Clear(); | 288 | m_fbb.Clear(); |
287 | 289 | ||
288 | m_server->close(); | 290 | //Connections will be cleaned up later |
289 | emit noClients(); | 291 | emit noClients(); |
290 | } | 292 | } |
291 | 293 | ||