Ticket #1424: html5-timers-managed-v2.patch
File html5-timers-managed-v2.patch, 1.9 KB (added by , 5 years ago) |
---|
-
html5/js/Protocol.js
122 122 this.websocket.onmessage = function (e) { 123 123 // push arraybuffer values onto the end 124 124 me.rQ.push(new Uint8Array(e.data)); 125 setTimeout(function() { 126 me.process_receive_queue(); 127 }, this.process_interval); 125 128 }; 126 129 this.start_processing(); 127 130 } … … 139 142 } 140 143 141 144 XpraProtocol.prototype.start_processing = function() { 142 var me = this;143 if(this.rQ_interval_id === null){144 this.rQ_interval_id = setInterval(function(){145 if (me.rQ.length > 0) {146 me.process_receive_queue();147 }148 }, this.process_interval);149 }150 151 if(this.sQ_interval_id === null){152 this.sQ_interval_id = setInterval(function(){153 if(me.sQ.length > 0){154 me.process_send_queue();155 }156 }, this.process_interval);157 }158 159 if(this.mQ_interval_id === null){160 this.mQ_interval_id = setInterval(function(){161 if(me.mQ.length > 0){162 me.process_message_queue();163 }164 }, this.process_interval);165 }166 145 } 167 146 XpraProtocol.prototype.stop_processing = function() { 168 147 clearInterval(this.rQ_interval_id); … … 349 328 } 350 329 if (this.is_worker){ 351 330 this.mQ[this.mQ.length] = packet; 331 var me = this; 332 setTimeout(function() { 333 me.process_message_queue(); 334 }, this.process_interval); 352 335 } else { 353 336 this.packet_handler(packet, this.packet_ctx); 354 337 } … … 358 341 //console.error("packet_data="+packet_data); 359 342 } 360 343 } 361 362 // see if buffer still has unread packets363 if (this.rQ.length > 0) {364 this.process_receive_queue();365 }366 344 } 367 345 368 346 XpraProtocol.prototype.process_send_queue = function() { … … 426 404 427 405 XpraProtocol.prototype.send = function(packet) { 428 406 this.sQ[this.sQ.length] = packet; 407 this.process_send_queue(); 429 408 } 430 409 431 410 XpraProtocol.prototype.set_packet_handler = function(callback, ctx) {