issue #76: quieten routing errors.

Receiving DEL_ROUTE without a corresponding ADD_ROUTE is now legit
behaviour, so don't print an error in this case.

Don't print an error for dropped messages if the reply_to indicates the
sender doesn't care about a response (dead and no_reply)
issue260
David Wilson 6 years ago
parent fba52a0edf
commit 58d0a45738

@ -1870,8 +1870,9 @@ class Router(object):
dead = False
if out_stream is None:
LOG.error('%r: no route for %r, my ID is %r',
self, msg, mitogen.context_id)
if msg.reply_to not in (0, IS_DEAD):
LOG.error('%r: no route for %r, my ID is %r',
self, msg, mitogen.context_id)
dead = True
if in_stream and self.unidirectional and not dead and \

@ -1598,11 +1598,12 @@ class Router(mitogen.core.Router):
def del_route(self, target_id):
LOG.debug('%r.del_route(%r)', self, target_id)
try:
del self._stream_by_id[target_id]
except KeyError:
LOG.error('%r: cant delete route to %r: no such stream',
self, target_id)
# DEL_ROUTE may be sent by a parent if it knows this context sent
# messages to a peer that has now disconnected, to let us raise
# 'disconnect' event on the appropriate Context instance. In that case,
# we won't a matching _stream_by_id entry for the disappearing route,
# so don't raise an error for a missing key here.
self._stream_by_id.pop(target_id, None)
def get_module_blacklist(self):
if mitogen.context_id == 0:

Loading…
Cancel
Save