bugfix / cleanup routine for delayed data

requests that could leak into CLI and cause corruption
10.3.x-maintenance
cTn 2014-02-10 16:26:43 +01:00
parent 238f18b5c5
commit 88ed454169
2 changed files with 11 additions and 5 deletions

View File

@ -67,17 +67,20 @@ var MSP = {
callbacks: [], callbacks: [],
packet_error: 0, packet_error: 0,
disconnect_cleanup: function() { callbacks_cleanup: function() {
this.state = 0; // reset packet state for "clean" initial entry (this is only required if user hot-disconnects)
this.packet_error = 0; // reset CRC packet error counter for next session
// kill all "raw" MSP timers
for (var i = 0; i < this.callbacks.length; i++) { for (var i = 0; i < this.callbacks.length; i++) {
clearInterval(this.callbacks[i].timer); clearInterval(this.callbacks[i].timer);
} }
// drop references // drop references
this.callbacks = []; this.callbacks = [];
},
disconnect_cleanup: function() {
this.state = 0; // reset packet state for "clean" initial entry (this is only required if user hot-disconnects)
this.packet_error = 0; // reset CRC packet error counter for next session
this.callbacks_cleanup();
} }
}; };

View File

@ -27,6 +27,9 @@ function tab_initialize_cli() {
$('#content').load("./tabs/cli.html", function() { $('#content').load("./tabs/cli.html", function() {
GUI.active_tab = 'cli'; GUI.active_tab = 'cli';
// remove any active interval for delayed command
MSP.callbacks_cleanup();
CLI_active = true; CLI_active = true;
// Enter CLI mode // Enter CLI mode