diff options
author | Michael P. Soulier <msoulier@digitaltorque.ca> | 2013-07-27 22:21:50 -0400 |
---|---|---|
committer | Michael P. Soulier <msoulier@digitaltorque.ca> | 2013-07-27 22:21:50 -0400 |
commit | d86ecb749c17948d9d76d7aad72ba23f24e5ec5a (patch) | |
tree | 1e961a814b9ccab30140227471ec83745374ec4b | |
parent | a10579994d3cff1ca491b8f9785ceb78dbe1343f (diff) | |
download | tftpy-d86ecb749c17948d9d76d7aad72ba23f24e5ec5a.tar.gz |
Adding graceful exit condition.
-rw-r--r-- | tftpy/TftpServer.py | 6 |
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) |