[Xmpp4js-commit] SF.net SVN: xmpp4js:[762] trunk/src/main/javascript/transport
Status: Beta
Brought to you by:
h-iverson
|
From: <h-i...@us...> - 2008-07-29 16:58:42
|
Revision: 762
http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=762&view=rev
Author: h-iverson
Date: 2008-07-29 16:58:51 +0000 (Tue, 29 Jul 2008)
Log Message:
-----------
tweaks to pausing stuff, moved serializeState and deserializeState to separate methods
Modified Paths:
--------------
trunk/src/main/javascript/transport/BOSH.js
trunk/src/main/javascript/transport/Base.js
trunk/src/main/javascript/transport/Script.js
Modified: trunk/src/main/javascript/transport/BOSH.js
===================================================================
--- trunk/src/main/javascript/transport/BOSH.js 2008-07-28 17:31:19 UTC (rev 761)
+++ trunk/src/main/javascript/transport/BOSH.js 2008-07-29 16:58:51 UTC (rev 762)
@@ -75,7 +75,10 @@
xmlNode: packetNode, // this isn't a real option... but it's needed for testing.
scope: this,
callback: this.onWriteResponse,
-
+ /*async: !this.isPausing, // use synchronous requests if we're pausing
+ // because it's generally called from onunload
+ // which will cut off async requests.
+ */
url: this.endpoint,
method: "POST",
// FIXME this.wait is sent by initial response. Change this timeout
Modified: trunk/src/main/javascript/transport/Base.js
===================================================================
--- trunk/src/main/javascript/transport/Base.js 2008-07-28 17:31:19 UTC (rev 761)
+++ trunk/src/main/javascript/transport/Base.js 2008-07-29 16:58:51 UTC (rev 762)
@@ -228,6 +228,8 @@
* then mark the session open and start the sendQueueTask.
*/
beginSession: function() {
+ this.isPausing = false;
+
this.rid = this.createInitialRid();
var packetNode = this.createPacketNode();
@@ -503,7 +505,11 @@
return Math.floor( Math.random() * 10000 );
},
+ isPausing: false,
+
pause: function(time) {
+ this.isPausing = true;
+
;;; Xmpp4Js.Transport.Base.logger.info( "Pausing session." );
this.fireEvent( "beforepause", time );
@@ -526,6 +532,15 @@
this.shutdown();
+ var pauseStruct = this.serializeState();
+
+ // give others an opportunity to serialize proprties
+ this.fireEvent( "pause", pauseStruct );
+
+ return pauseStruct;
+ },
+
+ serializeState: function() {
var pauseStruct = {
maxpause: 120, // TODO not hard code me
maxRequests: this.maxRequests,
@@ -542,15 +557,10 @@
keySeqIdx: this.keySeq._idx
};
- // give others an opportunity to serialize proprties
- this.fireEvent( "pause", pauseStruct );
-
return pauseStruct;
},
- resume: function(pauseStruct) {
-;;; Xmpp4Js.Transport.Base.logger.info( "Resume session. Session ID="+pauseStruct.sid+", Request ID="+pauseStruct.rid );
-
+ deserializeState: function(pauseStruct) {
// this.maxpause = pauseStruct.maxpause;
this.maxpause = pauseStruct.maxpause;
this.hold = pauseStruct.hold;
@@ -566,7 +576,15 @@
this.keySeq._keys = pauseStruct.keysSeqKeys;
this.keySeq._idx = pauseStruct.keySeqIdx;
+ },
+
+ resume: function(pauseStruct) {
+ this.isPausing = false;
+;;; Xmpp4Js.Transport.Base.logger.info( "Resume session. Session ID="+pauseStruct.sid+", Request ID="+pauseStruct.rid );
+
+ this.deserializeState(pauseStruct);
+
this.startup();
// give others an opportunity to deserialize properties
Modified: trunk/src/main/javascript/transport/Script.js
===================================================================
--- trunk/src/main/javascript/transport/Script.js 2008-07-28 17:31:19 UTC (rev 761)
+++ trunk/src/main/javascript/transport/Script.js 2008-07-29 16:58:51 UTC (rev 762)
@@ -64,24 +64,7 @@
Xmpp4Js.Transport.Script.logger = Xmpp4Js.createLogger( "xmpp4js.transport.script" );
Xmpp4Js.Transport.Script.prototype = {
- isPausing: false,
-
- pause: function() {
- this.isPausing = true;
- return Xmpp4Js.Transport.Script.superclass.pause.apply( this, arguments );
- },
-
- resume: function() {
- this.isPausing = false;
- return Xmpp4Js.Transport.Script.superclass.resume.apply( this, arguments )
- },
-
- connect: function() {
- this.isPausing = false;
- return Xmpp4Js.Transport.Script.superclass.connect.apply( this, arguments )
- },
-
-
+
/**
* Immediately write a raw packet node to the wire. Adds frame data including
* RID, SID and Key if they are present.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|