Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Knot projects
deckard
Commits
deb32d6f
Verified
Commit
deb32d6f
authored
Jun 07, 2018
by
Tomas Krizek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pydnstest/testserver: handle SIGTERM, SIGINT gracefully
parent
569ffd56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
pydnstest/testserver.py
pydnstest/testserver.py
+12
-6
No files found.
pydnstest/testserver.py
View file @
deb32d6f
...
...
@@ -4,8 +4,10 @@ import argparse
import
itertools
import
logging
import
os
import
signal
import
select
import
socket
import
sys
import
threading
import
time
...
...
@@ -256,13 +258,17 @@ def standalone_self_test():
server
.
start
()
logging
.
info
(
"[==========] Mirror server running at %s"
,
server
.
address
())
try
:
while
True
:
time
.
sleep
(
0.5
)
except
KeyboardInterrupt
:
def
exit
(
signum
,
frame
):
logging
.
info
(
"[==========] Shutdown."
)
pass
server
.
stop
()
server
.
stop
()
sys
.
exit
(
128
+
signum
)
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
while
True
:
time
.
sleep
(
0.5
)
if
__name__
==
'__main__'
:
...
...
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