From 2ac3c2e8041d189aff7c65101e562f5922e217d8 Mon Sep 17 00:00:00 2001 From: Pedro Beschorner Marin <pedrobmarin@gmail.com> Date: Fri, 14 Feb 2020 18:14:21 -0300 Subject: [PATCH] Check if peer connection isn't closed --- bigbluebutton-html5/imports/utils/stats.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/utils/stats.js b/bigbluebutton-html5/imports/utils/stats.js index 36b1a2949c..e558d4309f 100644 --- a/bigbluebutton-html5/imports/utils/stats.js +++ b/bigbluebutton-html5/imports/utils/stats.js @@ -15,11 +15,17 @@ const stop = callback => { return; }; +const isConnected = conn => { + if (conn && conn.connectionState === 'connected') return true; + + return false; +}; + const collect = (conn, callback) => { let stats = []; const monitor = (conn, stats, iteration) => { - if (!conn) return stop(callback); + if (!isConnected(conn)) return stop(callback); conn.getStats().then(results => { if (!results) return stop(callback); -- GitLab