From b41ebc4b72af2a784e75cf53613ff86fc29a695b Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Tue, 24 Jan 2023 11:32:08 +0000 Subject: [PATCH] [IMP] bus: mini typo in websocket protocol Well it is not a typo but a mini code improvement. The suggested diff clarifies the intent of `_handle_control_frame` with regards to `_get_messages`. Because it was `return self._handle...` we had to read the method to determine if it was returning something in order to know whether the message would be propagated to the rest of the websocket routing by `_get_message`. Now it is clear that the control frames are handled right away and that they are not propagated to the business. closes odoo/odoo#110834 Signed-off-by: Julien Castiaux --- addons/bus/websocket.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/bus/websocket.py b/addons/bus/websocket.py index 0878f599956..bbf0bd90d0e 100644 --- a/addons/bus/websocket.py +++ b/addons/bus/websocket.py @@ -414,7 +414,8 @@ class Websocket: """ frame = self._get_next_frame() if frame.opcode in CTRL_OP: - return self._handle_control_frame(frame) + self._handle_control_frame(frame) + return if self.state is not ConnectionState.OPEN: # After receiving a control frame indicating the connection # should be closed, a peer discards any further data