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 dead = False
if out_stream is None: if out_stream is None:
LOG.error('%r: no route for %r, my ID is %r', if msg.reply_to not in (0, IS_DEAD):
self, msg, mitogen.context_id) LOG.error('%r: no route for %r, my ID is %r',
self, msg, mitogen.context_id)
dead = True dead = True
if in_stream and self.unidirectional and not dead and \ 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): def del_route(self, target_id):
LOG.debug('%r.del_route(%r)', self, target_id) LOG.debug('%r.del_route(%r)', self, target_id)
try: # DEL_ROUTE may be sent by a parent if it knows this context sent
del self._stream_by_id[target_id] # messages to a peer that has now disconnected, to let us raise
except KeyError: # 'disconnect' event on the appropriate Context instance. In that case,
LOG.error('%r: cant delete route to %r: no such stream', # we won't a matching _stream_by_id entry for the disappearing route,
self, target_id) # so don't raise an error for a missing key here.
self._stream_by_id.pop(target_id, None)
def get_module_blacklist(self): def get_module_blacklist(self):
if mitogen.context_id == 0: if mitogen.context_id == 0:

Loading…
Cancel
Save