Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
f3559fa1
Commit
f3559fa1
authored
Dec 19, 2011
by
Jelte Jansen
Browse files
[1451] apply patch one
with a few amendments, see ticket comment
parent
ea85f834
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/ddns/ddns.py.in
View file @
f3559fa1
...
...
@@ -98,20 +98,32 @@ class DDNSServer:
'''
if cmd == "shutdown":
logger.info(DDNS_RECEIVED_SHUTDOWN_COMMAND)
self.shutdown()
self.
trigger_
shutdown()
answer = create_answer(0)
else:
answer = create_answer(1, "Unknown command: " + str(cmd))
return answer
def shutdown(self):
'''
Shut down the server. Perform any cleanup that is necessary.
Currently, this only sets the internal _shutdown value to true,
so the main loop in run() stops.
def trigger_shutdown(self):
'''Initiate a shutdown sequence.
This method is expected to be called in various ways including
in the middle of a signal handler, and is designed to be as simple
as possible to minimize side effects. Actual shutdown will take
place in a normal control flow.
'''
self._shutdown = True
logger.info(DDNS_SHUTDOWN)
self._shutdown = True
def shutdown_cleanup(self):
'''
Perform any cleanup that is necessary when shutting down the server.
Do NOT call this to initialize shutdown, use trigger_shutdown().
Currently, it does nothing, but cleanup routines are expected.
'''
pass
def run(self):
'''
...
...
@@ -126,6 +138,7 @@ class DDNSServer:
# make such a distinction easily, but once we do, this would
# be the place to catch.
self._cc.check_command(False)
self.shutdown_cleanup()
logger.info(DDNS_STOPPED)
def create_signal_handler(ddns_server):
...
...
@@ -140,7 +153,7 @@ def create_signal_handler(ddns_server):
here, the actual signal is not checked and the server is simply shut
down.
'''
ddns_server.shutdown()
ddns_server.
trigger_
shutdown()
return signal_handler
def set_signal_handler(signal_handler):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment