Author: titmuss
Date: Fri Feb  1 13:55:49 2008
New Revision: 1748

URL: http://svn.slimdevices.com?rev=1748&root=Jive&view=rev
Log:
 [EMAIL PROTECTED] (orig r1734):  titmuss | 2008-02-01 16:13:27 +0000
 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:
    trunk/   (props changed)
    trunk/jive/src/pkg/jive/share/jive/slim/SlimServer.lua

Propchange: trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Feb  1 13:55:49 2008
@@ -1,3 +1,3 @@
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1733
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1734
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: trunk/jive/src/pkg/jive/share/jive/slim/SlimServer.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/jive/slim/SlimServer.lua?rev=1748&root=Jive&r1=1747&r2=1748&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/jive/slim/SlimServer.lua (original)
+++ trunk/jive/src/pkg/jive/share/jive/slim/SlimServer.lua Fri Feb  1 13:55:49 
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

Reply via email to