[Pythondirector-stuff] dealing with clean server close
Brought to you by:
anthonybaxter
From: Tom S. <ts...@re...> - 2004-03-26 16:34:19
|
Hi, I started using pydirector yesterday, and for the most part it is perfect for my needs. However I encountered a problem with a particular HTTP UA and the twisted implementation. The HTTP UA makes a connection to the HTTP server through pydirector, and gets the data it needs. However an ethereal trace showed that when the HTTP server closed its connection to pydirector, pydirector did not close its connection to the UA, and the UA kept waiting. A look at pdnetworktwisted.py showed me this: def connectionLost(self, reason): """ the server is done, and has closed the connection. write out any remaining data, and close the socket. """ if self.receiver is not None: if reason.type is twisted.internet.error.ConnectionDone: return elif reason.type is twisted.internet.error.ConnectionLost: pass else: #print id(self),"connection to server lost:",reason pass self.receiver.transport.loseConnection() It appears that for the ConnectionDone case, pydirector is not closing the connection to the client. This is called out as a special case, so I assume there is a reason, but I don't see it. Can you help me understand? Thanks, Tom Smith. |