Author: titmuss
Date: Fri Feb 1 08:13:27 2008
New Revision: 1734
URL: http://svn.slimdevices.com?rev=1734&root=Jive&view=rev
Log:
Bug: 6764
Description:
Maintain a single server object per server. Following a disconnect a new server
object was created, this meant the players
were moved between the objects even though they were still connected to the
same server.
Modified:
branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServer.lua
Modified: branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServer.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServer.lua?rev=1734&root=Jive&r1=1733&r2=1734&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServer.lua (original)
+++ branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServer.lua Fri Feb 1
08:13:27 2008
@@ -60,6 +60,11 @@
-- our class constants
local RETRY_UNREACHABLE = 120 -- Min delay (in s) before retrying a
server unreachable
+
+
+-- list of servers index by id.
+local servers = {}
+setmetatable(servers, { __mode = 'v' })
-- _getSink
@@ -193,8 +198,19 @@
_assert(ip, "Cannot create SlimServer without ip address")
+ -- Only create one server object per server. This avoids duplicates
+ -- following a server disconnect.
+
+ local id = self:idFor(ip, port, name)
+ local obj = servers[id]
+ if obj then
+ return obj
+ end
+
+
local obj = oo.rawnew(self, {
+ id = id,
name = name,
jnt = jnt,
@@ -232,6 +248,8 @@
})
obj.id = obj:idFor(ip, port, name)
+
+ servers[obj.id] = obj
-- subscribe to comet events
jnt:subscribe(obj)
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins