|
From: <ma...@us...> - 2012-01-02 22:00:37
|
Revision: 626
http://openautomation.svn.sourceforge.net/openautomation/?rev=626&view=rev
Author: mayerch
Date: 2012-01-02 22:00:31 +0000 (Mon, 02 Jan 2012)
Log Message:
-----------
Bug fix for #3468526: Initial read is repeated after COMET Timeout
Modified Paths:
--------------
CometVisu/trunk/visu/lib/cometvisu-client.js
Modified: CometVisu/trunk/visu/lib/cometvisu-client.js
===================================================================
--- CometVisu/trunk/visu/lib/cometvisu-client.js 2012-01-02 12:08:29 UTC (rev 625)
+++ CometVisu/trunk/visu/lib/cometvisu-client.js 2012-01-02 22:00:31 UTC (rev 626)
@@ -32,6 +32,7 @@
this.xhr = false; // the ongoing AJAX request
this.watchdogTimer = 5; // in Seconds - the alive check intervall of the watchdog
this.maxConnectionAge = 60; // in Seconds - restart if last read is older
+ this.lastIndex = 0; // index returned by the last request
/**
* This function gets called once the communication is established and session information is available
@@ -54,7 +55,7 @@
*/
this.handleRead = function( json )
{
- if( !json )
+ if( !json && !this.doRestart )
{
if( this.running )
{ // retry initial request
@@ -64,13 +65,16 @@
return;
}
- var lastIndex = json.i;
- var data = json.d;
- this.update( data );
+ if( !this.doRestart )
+ {
+ this.lastIndex = json.i;
+ var data = json.d;
+ this.update( data );
+ }
if( this.running )
{ // keep the requests going
- this.xhr = $.ajax( {url:this.urlPrefix + 'r',dataType: 'json',context:this,data:this.buildRequest()+'&i='+lastIndex, success:this.handleRead ,error:this.handleError/*,complete:this.handleComplete*/ } );
+ this.xhr = $.ajax( {url:this.urlPrefix + 'r',dataType: 'json',context:this,data:this.buildRequest()+'&i='+this.lastIndex, success:this.handleRead ,error:this.handleError/*,complete:this.handleComplete*/ } );
watchdog.ping();
}
};
@@ -168,8 +172,8 @@
{
this.doRestart = true;
if( this.xhr.abort ) this.xhr.abort();
+ this.handleRead(); // restart
this.doRestart = false;
- this.handleRead(); // restart
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|