]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9258: Recursive calls to $.verto.rpcClient.speedTest() don't work
authorChad Phillips <chad@apartmentlines.com>
Wed, 25 Jul 2018 02:05:09 +0000 (21:05 -0500)
committerChad Phillips <chad@apartmentlines.com>
Wed, 25 Jul 2018 02:05:09 +0000 (21:05 -0500)
Assigning the speedTest callback funtion to a local variable and unsetting
the this.speedCB instance variable prior to calling the callback function
allows the rpcClient.speedTest functionality to be used more creatively
(such as calling it recursively for multiple runs) without affecting existing
functionality.

html5/verto/js/src/jquery.jsonrpcclient.js

index 5beb85fc503887f3c6b3403dae953f00e8294ba8..4b0b71019e624d7a90161b3dab6060a47a20a4ab 100644 (file)
                var down_kps = (((this.speedBytes * 8) / (this.down_dur / 1000)) / 1024).toFixed(0);
                
                console.info("Speed Test: Up: " + up_kps + " Down: " + down_kps);
-               this.speedCB(event, { upDur: this.up_dur, downDur: this.down_dur, upKPS: up_kps, downKPS: down_kps });
+               var cb = this.speedCB;
                this.speedCB = null;
+               cb(event, {
+                       upDur: this.up_dur,
+                       downDur: this.down_dur,
+                       upKPS: up_kps,
+                       downKPS: down_kps
+               });
            }
            
            return;