From 6e82d8ee08e9dbbbb420b367e79a6e7c7438f6b2 Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Mon, 6 Feb 2023 13:59:50 +0000 Subject: [PATCH] [FIX] web_editor: set recovery connection to 3s When trying to recover peer to peer connection, the timeout of 500ms or 1000ms might be too short and 15000ms in unnecessary too long. If the timeout is too short, it could remove the connection before the peer to peer had the time to reconnect to it. When we call `_recoverConnection` on `disconnect` in `oniceconnectionstatechange` or `onconnectionstatechange`, the signal `disconnect` does not necessarily mean that it will remain disconnected. Doing nothing could be enough to reconnect. (see: https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-disconnected) closes odoo/odoo#112182 X-original-commit: 3647374c63fcd4bccf501e49a2af6a707fedd737 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js b/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js index 7aac629392c..39ecb806bd7 100644 --- a/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js +++ b/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js @@ -426,7 +426,7 @@ export class PeerToPeer { break; case 'disconnected': await this._recoverConnection(clientId, { - delay: 1000, + delay: 3000, reason: 'ice connection disconnected', }); break; @@ -446,7 +446,7 @@ export class PeerToPeer { break; case 'disconnected': await this._recoverConnection(clientId, { - delay: 500, + delay: 3000, reason: 'connection disconnected', }); break; @@ -468,7 +468,7 @@ export class PeerToPeer { console.trace(error); console.groupEnd(); } - this._recoverConnection(clientId, { delay: 15000, reason: 'ice candidate error' }); + this._recoverConnection(clientId, { delay: 3000, reason: 'ice candidate error' }); }; const dataChannel = pc.createDataChannel('notifications', { negotiated: true, id: 1 }); let message = [];