Author: titmuss
Date: Tue Jan 29 13:20:24 2008
New Revision: 1681
URL: http://svn.slimdevices.com?rev=1681&root=Jive&view=rev
Log:
[EMAIL PROTECTED] (orig r1679): titmuss | 2008-01-29 21:19:40 +0000
Bug: N/A
Description:
SN was returning the event.id as a string, this meant that all requests were
kept in the sent_reqs tables. Cast to a number to prevent
this.
Modified:
trunk/ (props changed)
trunk/jive/src/pkg/jive/share/jive/net/Comet.lua
Propchange: trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Tue Jan 29 13:20:24 2008
@@ -1,3 +1,3 @@
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1677
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1679
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378
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=1681&root=Jive&r1=1680&r2=1681&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/jive/net/Comet.lua (original)
+++ trunk/jive/src/pkg/jive/share/jive/net/Comet.lua Tue Jan 29 13:20:24 2008
@@ -57,7 +57,7 @@
-- stuff we use
-local assert, ipairs, table, pairs, string = assert, ipairs, table, pairs,
string
+local assert, ipairs, table, pairs, string, tonumber = assert, ipairs, table,
pairs, string, tonumber
local oo = require("loop.simple")
local math = require("math")
@@ -337,14 +337,16 @@
function subscribe(self, subscription, func, playerid, request, priority)
+ local id = self.reqid
+
if log:isDebug() then
- log:debug(self, ": subscribe(", subscription, " ", func, ", ",
playerid, ", ", table.concat(request, ","), ", priority:", priority, ")")
+ log:debug(self, ": subscribe(", subscription, " ", func, ",
reqid:", id, ", ", playerid, ", ", table.concat(request, ","), ", priority:",
priority, ")")
end
-- Remember subs to send during connect now, or if we get
-- disconnected
table.insert( self.subs, {
- reqid = self.reqid,
+ reqid = id,
subscription = subscription,
playerid = playerid,
request = request,
@@ -354,7 +356,7 @@
} )
-- Bump reqid for the next request
- self.reqid = self.reqid + 1
+ self.reqid = id + 1
-- Send immediately unless we're batching queries
if self.active ~= CONNECTED or self.batch ~= 0 then
@@ -367,7 +369,9 @@
function unsubscribe(self, subscription, func)
- log:debug(self, ": unsubscribe(", subscription, ", ", func, ")")
+ local id = self.reqid
+
+ log:debug(self, ": unsubscribe(", subscription, ", ", func, " reqid:",
id, ")")
-- Remove from notify list
if func then
@@ -395,12 +399,12 @@
-- Add to pending unsubs
table.insert(self.pending_unsubs, {
- reqid = self.reqid,
+ reqid = id,
subscription = subscription,
} )
-- Bump reqid for the next request
- self.reqid = self.reqid + 1
+ self.reqid = id + 1
-- Send immediately unless we're batching queries
if self.state ~= CONNECTED or self.batch ~= 0 then
@@ -745,17 +749,17 @@
-- Remove request from sent queue
for i, v in ipairs( self.sent_reqs ) do
- if v.id == event.id then
- table.remove(self.sent_reqs, i)
+ if v.id == tonumber(event.id) then
+ table.remove( self.sent_reqs, i )
break
end
end
-- Log response
if event.error then
- log:warn(self, ": _response, ", event.channel, "
failed: ", event.error)
+ log:warn(self, ": _response, ", event.channel, " id=",
event.id, " failed: ", event.error)
else
- log:debug(self, ": _response, ", event.channel, " OK")
+ log:debug(self, ": _response, ", event.channel, " id=",
event.id, " OK")
end
-- Update advice if any
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins