[sans-io] remove hook replies

Hooks should not have immediate replies. Instead, they should modify
the object passed over the hook.
This commit is contained in:
Maximilian Hils 2017-08-07 01:46:04 +02:00
parent 4a9cd7f36f
commit 967d48bdfa

View File

@ -33,8 +33,9 @@ class ProxyConnectionHandler(server.ConnectionHandler):
submit = lambda x: self.loop.call_soon_threadsafe(lambda: q.put_nowait(x)) submit = lambda x: self.loop.call_soon_threadsafe(lambda: q.put_nowait(x))
hook.data.reply = AsyncReply(submit, hook.data) hook.data.reply = AsyncReply(submit, hook.data)
self.event_queue.put((hook.name, hook.data)) self.event_queue.put((hook.name, hook.data))
reply = await q.get() await q.get()
self.server_event(events.HookReply(hook, reply)) if hook.blocking:
self.server_event(events.HookReply(hook, None))
def _debug(self, *args): def _debug(self, *args):
x = log.LogEntry(" ".join(str(x) for x in args), "warn") x = log.LogEntry(" ".join(str(x) for x in args), "warn")