mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 10:56:10 +00:00
Describe the restart race as what it is, not as what it is not
The comment claimed the new process would take itself for the second copy and hand its command over. That is the command line's path, through cli.run and ipc.send; run_app with --gui never asks whether anything is already running, it calls listen() and prints if that fails. The change is the same one either way: two processes asking for one name is either two servers answering on it or a listen that fails into a console nobody reads, and closing first leaves neither.
This commit is contained in:
@@ -906,9 +906,12 @@ class Dikte:
|
||||
self.shutdown()
|
||||
# Stop answering before the replacement is started, not just afterwards.
|
||||
# execv leaves nothing behind to answer, but a Windows restart is two
|
||||
# processes for a moment, and a new one that reached a server still
|
||||
# listening would take itself for the second copy, hand its command over
|
||||
# and exit, leaving nothing running at all.
|
||||
# processes for a moment, and removeServer does nothing about a name
|
||||
# another process is holding. The new one then either opens a second
|
||||
# server on a name the old one is still answering on, so that a command
|
||||
# arriving in that moment reaches the process that is going away, or
|
||||
# fails to open one at all and says so to a console nobody is watching.
|
||||
# Closing first leaves neither.
|
||||
if self.server is not None:
|
||||
self.server.close()
|
||||
QLocalServer.removeServer(SERVER_NAME)
|
||||
|
||||
Reference in New Issue
Block a user