Skip to content

Commit

Permalink
issue #213: core: have Message.reply() log msg for zero reply_to
Browse files Browse the repository at this point in the history
It's easy to call msg.reply() by accident on a message that never had
reply_to set, resulting in a "invalid handle" error message coming from
router. Instead log a more accurate message on the stack that actualy
caused the problem.
  • Loading branch information
dw committed May 28, 2018
1 parent 6335855 commit 2310497
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mitogen/core.py
Expand Up @@ -380,7 +380,10 @@ def reply(self, msg, router=None, **kwargs):
msg.dst_id = self.src_id
msg.handle = self.reply_to
vars(msg).update(kwargs)
(self.router or router).route(msg)
if msg.handle:
(self.router or router).route(msg)
else:
LOG.debug('Message.reply(): discarding due to zero handle: %r', msg)

def unpickle(self, throw=True, throw_dead=True):
"""Deserialize `data` into an object."""
Expand Down

0 comments on commit 2310497

Please sign in to comment.