From 27d7ea85e89f95bac367e470a487c2569032a115 Mon Sep 17 00:00:00 2001 From: meejah Date: Wed, 7 Apr 2021 16:30:54 -0600 Subject: [PATCH] error-handling --- src/wormhole_transit_relay/transit_server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wormhole_transit_relay/transit_server.py b/src/wormhole_transit_relay/transit_server.py index be543d1..259c61c 100644 --- a/src/wormhole_transit_relay/transit_server.py +++ b/src/wormhole_transit_relay/transit_server.py @@ -288,7 +288,11 @@ class WebSocketTransitConnection(WebSocketServerProtocol): if token is None: self._state.bad_token() else: - self._state.got_bytes(payload) + try: + self._state.got_bytes(payload) + except Exception as e: + log.err("Failed to send to partner: {}".format(e)) + self.sendClose(3000, "send to partner failed") def disconnect_redundant(self): # this is called if a buddy connected and we were found unnecessary.