Terminate can be called on an unconnected server connection.

This commit is contained in:
Aldo Cortesi 2013-07-28 18:05:04 +12:00
parent 10a9e3365f
commit df3d2d70ed
1 changed files with 9 additions and 8 deletions

View File

@ -82,14 +82,15 @@ class ServerConnection(tcp.TCPClient):
self.wfile.flush()
def terminate(self):
try:
self.wfile.flush()
except IOError: # pragma: no cover
pass
try:
self.connection.close()
except IOError:
pass
if self.connection:
try:
self.wfile.flush()
except IOError: # pragma: no cover
pass
try:
self.connection.close()
except IOError:
pass