Author: titmuss
Date: Fri Feb 22 13:27:31 2008
New Revision: 2004
URL: http://svn.slimdevices.com?rev=2004&root=Jive&view=rev
Log:
Merge r2000-r2003 from trunk.
Modified:
branches/7.0/jive/src/pkg/jive/share/jive/net/Socket.lua
branches/7.0/jive/src/pkg/jive/share/jive/net/SocketHttp.lua
branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServer.lua
branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServers.lua
Modified: branches/7.0/jive/src/pkg/jive/share/jive/net/Socket.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/jive/net/Socket.lua?rev=2004&root=Jive&r1=2003&r2=2004&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/jive/net/Socket.lua (original)
+++ branches/7.0/jive/src/pkg/jive/share/jive/net/Socket.lua Fri Feb 22
13:27:31 2008
@@ -134,23 +134,21 @@
-- t_add/remove/read/write
function t_addRead(self, pump, timeout)
- if not self.readPump then
- -- task to iterate over all read pumps
- local task = Task(tostring(self) .. "(R)",
- self,
- function(self, networkErr)
- while self.readPump do
- if not
self.readPump(networkErr) then
- self, networkErr =
Task:yield(false)
- end
+ -- task to iterate over all read pumps
+ local task = Task(tostring(self) .. "(R)",
+ self,
+ function(self, networkErr)
+ while self.readPump do
+ if not self.readPump(networkErr) then
+ self, networkErr =
Task:yield(false)
end
- end,
- _taskError,
- self.priority)
- self.jnt:t_addRead(self.t_sock, task, timeout)
- end
+ end
+ end,
+ _taskError,
+ self.priority)
self.readPump = pump
+ self.jnt:t_addRead(self.t_sock, task, timeout)
end
function t_removeRead(self)
@@ -161,23 +159,21 @@
end
function t_addWrite(self, pump, timeout)
- if not self.writePump then
- -- task to iterate over all write pumps
- local task = Task(tostring(self) .. "(W)",
- self,
- function(self, networkErr)
- while self.writePump do
- if not
self.writePump(networkErr) then
- self, networkErr =
Task:yield(false)
- end
+ -- task to iterate over all write pumps
+ local task = Task(tostring(self) .. "(W)",
+ self,
+ function(self, networkErr)
+ while self.writePump do
+ if not self.writePump(networkErr) then
+ self, networkErr =
Task:yield(false)
end
- end,
- _taskError,
- self.priority)
- self.jnt:t_addWrite(self.t_sock, task, timeout)
- end
-
+ end
+ end,
+ _taskError,
+ self.priority)
+
self.writePump = pump
+ self.jnt:t_addWrite(self.t_sock, task, timeout)
end
function t_removeWrite(self)
Modified: branches/7.0/jive/src/pkg/jive/share/jive/net/SocketHttp.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/jive/net/SocketHttp.lua?rev=2004&root=Jive&r1=2003&r2=2004&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/jive/net/SocketHttp.lua (original)
+++ branches/7.0/jive/src/pkg/jive/share/jive/net/SocketHttp.lua Fri Feb 22
13:27:31 2008
@@ -61,7 +61,9 @@
local BLOCKSIZE = 4096
-local SOCKET_TIMEOUT = 70 -- timeout for socket operations (seconds)
+-- timeout for socket operations
+local SOCKET_CONNECT_TIMEOUT = 10 -- connect in 10 seconds
+local SOCKET_TIMEOUT = 70 -- response in 70 seconds
--[[
@@ -346,7 +348,7 @@
self:t_nextSendState(true, 't_sendComplete')
end
- self:t_addWrite(pump, SOCKET_TIMEOUT)
+ self:t_addWrite(pump, SOCKET_CONNECT_TIMEOUT)
end
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=2004&root=Jive&r1=2003&r2=2004&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 22
13:27:31 2008
@@ -248,6 +248,7 @@
-- are we connected to the server?
active = false,
+ connecting = false,
-- queue of artwork to fetch
artworkFetchQueue = {},
@@ -354,6 +355,8 @@
function connect(self)
log:info(self, ":connect()")
+ self.connecting = true
+
-- artwork pool connects on demand
self.comet:connect()
end
@@ -361,6 +364,8 @@
function disconnect(self)
log:info(self, ":disconnect()")
+
+ self.connecting = false
self.artworkPool:close()
self.comet:disconnect()
@@ -405,7 +410,8 @@
=cut
--]]
function idFor(self, ip, port, name)
- return tostring(ip) .. ":" .. tostring(port)
+ -- XXXX remove this function and just use SC name
+ return name
end
@@ -419,14 +425,33 @@
=cut
--]]
-function updateFromUdp(self, name)
+function updateFromUdp(self, ip, port, name)
log:debug(self, ":updateFromUdp()")
-- update the name in all cases
if self.name ~= name then
-
log:info(self, ": Renamed to ", name)
self.name = name
+ end
+
+ if self.plumbing.ip ~= ip or self.plumbing.port ~= port then
+ log:info(self, ": IP Address changed to ", ip , ":", port, "
connecting=", self.connecting)
+
+ local connecting = self.connecting
+
+ -- close old comet connection
+ self:disconnect()
+
+ -- open new comet connection
+ self.plumbing.ip = ip
+ self.plumbing.port = port
+ self.artworkPool = HttpPool(self.jnt, name, ip, port, 2, 1,
Task.PRIORITY_LOW)
+ self.comet = Comet(self.jnt, ip, port, '/cometd', name)
+
+ -- reconnect, if we were already connected
+ if connecting then
+ self:connect()
+ end
end
self.plumbing.lastSeen = Framework:getTicks()
Modified: branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServers.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServers.lua?rev=2004&root=Jive&r1=2003&r2=2004&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServers.lua (original)
+++ branches/7.0/jive/src/pkg/jive/share/jive/slim/SlimServers.lua Fri Feb 22
13:27:31 2008
@@ -94,7 +94,7 @@
-- update the server with the name info, might have changed
-- also keeps track of the last time we've seen the server for deletion
- self._servers[ss_id]:updateFromUdp(ss_name)
+ self._servers[ss_id]:updateFromUdp(ss_ip, ss_port, ss_name)
end
@@ -462,6 +462,19 @@
end
+-- restart discovery if the current slimserver disconnects
+function notify_serverDisconnected(self, slimserver)
+ if not self.currentPlayer or self.currentPlayer:getSlimServer() ~=
slimserver then
+ return
+ end
+
+ -- start discovery, use a timer to make sure we don't loop
+ -- back into the Comet class while handling the event.
+ self.discoverState = 'discover'
+ self.discoverTimer:restart(1)
+end
+
+
-- restart discovery on new network
function notify_networkConnected(self)
log:info("network connected")
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins