diff --git a/src/wormhole/blocking/transcribe.py b/src/wormhole/blocking/transcribe.py index 2e88c5b..86f24c2 100644 --- a/src/wormhole/blocking/transcribe.py +++ b/src/wormhole/blocking/transcribe.py @@ -68,6 +68,8 @@ class Channel: timeout=self._timeout) r.raise_for_status() resp = r.json() + if "welcome" in resp: + self._handle_welcome(resp["welcome"]) self._add_inbound_messages(resp["messages"]) def get_first_of(self, phases): diff --git a/src/wormhole/twisted/transcribe.py b/src/wormhole/twisted/transcribe.py index 6ea9e41..044d217 100644 --- a/src/wormhole/twisted/transcribe.py +++ b/src/wormhole/twisted/transcribe.py @@ -106,6 +106,11 @@ class Channel: "phase": phase, "body": hexlify(msg).decode("ascii")} d = post_json(self._agent, self._relay_url+"add", payload) + def _maybe_handle_welcome(resp): + if "welcome" in resp: + self._handle_welcome(resp["welcome"]) + return resp + d.addCallback(_maybe_handle_welcome) d.addCallback(lambda resp: self._add_inbound_messages(resp["messages"])) return d