diff options
author | Kenny Millington <kenny@helios.(none)> | 2010-10-18 12:44:02 +0100 |
---|---|---|
committer | Michael P. Soulier <msoulier@digitaltorque.ca> | 2010-10-22 20:33:23 -0400 |
commit | a6cff4f0b23068218849e44718e7255b634a9872 (patch) | |
tree | ba5042b98901a37eee9b381c909f78bf79dd4c3d | |
parent | 71d827dd89b78424f5d89e712e0a189ca2fcc71d (diff) | |
download | tftpy-a6cff4f0b23068218849e44718e7255b634a9872.tar.gz |
Fix exceptions propagating out of TftpServer.listen()
Signed-off-by: Michael P. Soulier <msoulier@digitaltorque.ca>
-rw-r--r-- | tftpy/TftpServer.py | 7 | ||||
-rw-r--r-- | tftpy/TftpStates.py | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/tftpy/TftpServer.py b/tftpy/TftpServer.py index f943b93..9e64d83 100644 --- a/tftpy/TftpServer.py +++ b/tftpy/TftpServer.py @@ -107,7 +107,12 @@ class TftpServer(TftpSession): timeout, self.root, self.dyn_file_func) - self.sessions[key].start(buffer) + try: + self.sessions[key].start(buffer) + except TftpException, err: + deletion_list.append(key) + log.error("Fatal exception thrown from " + "session %s: %s" % (key, str(err))) else: log.warn("received traffic on main socket for " "existing session??") diff --git a/tftpy/TftpStates.py b/tftpy/TftpStates.py index c521e51..142029c 100644 --- a/tftpy/TftpStates.py +++ b/tftpy/TftpStates.py @@ -115,7 +115,7 @@ class TftpContext(object): called explicitely by the calling code, this works better than the destructor.""" log.debug("in TftpContext.end") - if not self.fileobj.closed: + if self.fileobj is not None and not self.fileobj.closed: log.debug("self.fileobj is open - closing") self.fileobj.close() |