From 7467fc2b0b33ae16d0a73e8fefb10f8eaeed283d Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 7 Sep 2017 02:47:50 +0530 Subject: [PATCH] Allow CALL_FUNCTION from non-master context. Just ensure CALL_FUNCTION return value is sent back to src_id/reply_to rather than 0/reply_to. --- econtext/core.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/econtext/core.py b/econtext/core.py index 50974ca9..065f2583 100644 --- a/econtext/core.py +++ b/econtext/core.py @@ -1093,11 +1093,15 @@ class ExternalContext(object): obj = getattr(obj, klass) fn = getattr(obj, func) ret = fn(*args, **kwargs) - self.master.send(Message.pickled(ret, handle=msg.reply_to)) + self.router.route( + Message.pickled(ret, dst_id=msg.src_id, handle=msg.reply_to) + ) except Exception, e: LOG.debug('_dispatch_calls: %s', e) e = CallError(str(e)) - self.master.send(Message.pickled(e, handle=msg.reply_to)) + self.router.route( + Message.pickled(e, dst_id=msg.src_id, handle=msg.reply_to) + ) def main(self, parent_id, context_id, key, debug, log_level, in_fd=100, out_fd=1, core_src_fd=101, setup_stdio=True):