Fix exceptions propagating out of TftpServer.listen()
Signed-off-by: Michael P. Soulier <msoulier@digitaltorque.ca>
This commit is contained in:
parent
71d827dd89
commit
a6cff4f0b2
2 changed files with 7 additions and 2 deletions
|
@ -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??")
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Reference in a new issue