Author: titmuss
Date: Fri Feb 22 13:24:52 2008
New Revision: 2003
URL: http://svn.slimdevices.com?rev=2003&root=Jive&view=rev
Log:
Bug: 7240
Description:
Fix Comet to always update isactive, otherwise the state machine could become
confused and it would not reconnect to SC.
Rewrite the client id in any sent requests following a re-handshake, previously
any resent requests had the wrong clientid
and were ignored by SC. This could leave the Jive ui stuck.
In comentDisconnected notfications inluce sent reqeusts in the request count,
this means the Connection Problem request will
appear when it should.
Modified:
trunk/jive/src/pkg/jive/share/jive/net/Comet.lua
Modified: trunk/jive/src/pkg/jive/share/jive/net/Comet.lua
URL:
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/jive/net/Comet.lua?rev=2003&root=Jive&r1=2002&r2=2003&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/jive/net/Comet.lua (original)
+++ trunk/jive/src/pkg/jive/share/jive/net/Comet.lua Fri Feb 22 13:24:52 2008
@@ -174,6 +174,8 @@
function connect(self)
log:debug(self, ": connect state=", self.state)
+ self.isactive = true
+
if self.state == CONNECTING or self.state == CONNECTED then
-- Already connecting/connected
return
@@ -184,13 +186,14 @@
_state(self, UNCONNECTED)
end
- self.isactive = true
_handshake(self)
end
function disconnect(self)
log:debug(self, ": disconnect state=", self.state)
+
+ self.isactive = false
if self.state == UNCONNECTED or self.state == UNCONNECTING then
-- Already disconnecting/unconnected
@@ -203,7 +206,6 @@
return
end
- self.isactive = false
_disconnect(self)
end
@@ -442,7 +444,7 @@
-- Send immediately unless we're batching queries
if self.state ~= CONNECTED or self.batch ~= 0 then
if self.state ~= CONNECTED then
- self.jnt:notify('cometDisconnected', self,
#self.pending_reqs)
+ self.jnt:notify('cometDisconnected', self,
#self.pending_reqs + #self.sent_reqs)
end
return id
@@ -522,7 +524,7 @@
self.chttp:close()
self.rhttp:close()
- self.jnt:notify('cometDisconnected', self, #self.pending_reqs)
+ self.jnt:notify('cometDisconnected', self, #self.pending_reqs +
#self.sent_reqs)
end
end
@@ -608,6 +610,14 @@
self.advice = data.advice
log:debug(self, ": _handshake OK, clientId: ",
self.clientId)
+
+ -- Rewrite clientId in requests to be reset
+ for i, req in ipairs(self.sent_reqs) do
+ if req.data.response then
+ req.data.response =
string.gsub(req.data.response, "/(%x+)/", "/" .. self.clientId .. "/")
+ end
+ end
+
-- Continue with connect phase, note we are still not
CONNECTED
_connect(self)
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins