summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael P. Soulier <msoulier@digitaltorque.ca>2013-07-27 22:21:50 -0400
committerMichael P. Soulier <msoulier@digitaltorque.ca>2013-07-27 22:21:50 -0400
commitd86ecb749c17948d9d76d7aad72ba23f24e5ec5a (patch)
tree1e961a814b9ccab30140227471ec83745374ec4b
parenta10579994d3cff1ca491b8f9785ceb78dbe1343f (diff)
downloadtftpy-d86ecb749c17948d9d76d7aad72ba23f24e5ec5a.tar.gz
Adding graceful exit condition.
-rw-r--r--tftpy/TftpServer.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tftpy/TftpServer.py b/tftpy/TftpServer.py
index b628a35..6993d44 100644
--- a/tftpy/TftpServer.py
+++ b/tftpy/TftpServer.py
@@ -84,6 +84,12 @@ class TftpServer(TftpSession):
self.sessions = []
break
+ elif self.shutdown_gracefully:
+ if not self.sessions:
+ log.warn("In graceful shutdown mode and all sessions complete.")
+ self.sock.close()
+ break
+
# Build the inputlist array of sockets to select() on.
inputlist = []
inputlist.append(self.sock)