Commit 0d2d90f3 authored by Vincent Pelletier's avatar Vincent Pelletier

Document why _timeout.update must be called.

This code appeared obscure upon second read, so I document it.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2007 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent b0c35b4f
...@@ -490,6 +490,7 @@ class Connection(BaseConnection): ...@@ -490,6 +490,7 @@ class Connection(BaseConnection):
msg_id = self._getNextId() msg_id = self._getNextId()
packet.setId(msg_id) packet.setId(msg_id)
self._addPacket(packet) self._addPacket(packet)
# If there is no pending request, initialise timeout values.
if not self._handlers.isPending(): if not self._handlers.isPending():
self._timeout.update(time(), timeout=timeout) self._timeout.update(time(), timeout=timeout)
self._handlers.emit(packet) self._handlers.emit(packet)
...@@ -610,6 +611,7 @@ class MTClientConnection(ClientConnection): ...@@ -610,6 +611,7 @@ class MTClientConnection(ClientConnection):
packet.setId(msg_id) packet.setId(msg_id)
self.dispatcher.register(self, msg_id, self._local_var.queue) self.dispatcher.register(self, msg_id, self._local_var.queue)
self._addPacket(packet) self._addPacket(packet)
# If there is no pending request, initialise timeout values.
if not self._handlers.isPending(): if not self._handlers.isPending():
self._timeout.update(time(), timeout=timeout) self._timeout.update(time(), timeout=timeout)
self._handlers.emit(packet) self._handlers.emit(packet)
......
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