Commit 94350c6f authored by Vincent Pelletier's avatar Vincent Pelletier

Add logs for each kind of connection closure caused by remote peer.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@739 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6be5487f
...@@ -274,6 +274,7 @@ class Connection(BaseConnection): ...@@ -274,6 +274,7 @@ class Connection(BaseConnection):
try: try:
data = self.connector.receive() data = self.connector.receive()
if not data: if not data:
logging.info('Connection %r closed in recv', self.connector)
self.handler.connectionClosed(self) self.handler.connectionClosed(self)
self.close() self.close()
return return
...@@ -288,9 +289,11 @@ class Connection(BaseConnection): ...@@ -288,9 +289,11 @@ class Connection(BaseConnection):
except ConnectorConnectionClosedException: except ConnectorConnectionClosedException:
# connection resetted by peer, according to the man, this error # connection resetted by peer, according to the man, this error
# should not occurs but it seems it's false # should not occurs but it seems it's false
logging.info('Connection reset by peer: %r', self.connector)
self.handler.connectionClosed(self) self.handler.connectionClosed(self)
self.close() self.close()
except ConnectorException: except ConnectorException:
logging.info('Unknown connection error: %r', self.connector)
self.handler.connectionClosed(self) self.handler.connectionClosed(self)
self.close() self.close()
# unhandled connector exception # unhandled connector exception
...@@ -303,6 +306,7 @@ class Connection(BaseConnection): ...@@ -303,6 +306,7 @@ class Connection(BaseConnection):
try: try:
n = self.connector.send(self.write_buf) n = self.connector.send(self.write_buf)
if not n: if not n:
logging.info('Connection %r closed in send', self.connector)
self.handler.connectionClosed(self) self.handler.connectionClosed(self)
self.close() self.close()
return return
...@@ -311,9 +315,11 @@ class Connection(BaseConnection): ...@@ -311,9 +315,11 @@ class Connection(BaseConnection):
pass pass
except ConnectorConnectionClosedException: except ConnectorConnectionClosedException:
# connection resetted by peer # connection resetted by peer
logging.info('Connection reset by peer: %r', self.connector)
self.handler.connectionClosed(self) self.handler.connectionClosed(self)
self.close() self.close()
except ConnectorException: except ConnectorException:
logging.info('Unknown connection error: %r', self.connector)
# unhandled connector exception # unhandled connector exception
self.handler.connectionClosed(self) self.handler.connectionClosed(self)
self.close() self.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment