Author: ayoung
Date: Tue Feb 23 08:00:36 2010
New Revision: 8556

URL: http://svn.slimdevices.com/jive?rev=8556&view=rev
Log:
bug 15633: cannot switch to SD card content without network 
Only have SlimProto:isConnecting() return true when properly connected, and
have LocalPlayer use a more robust test to determine if server switching can be
accomplished by the currently-connected server.

Modified:
    7.5/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua
    7.5/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua?rev=8556&r1=8555&r2=8556&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua 
(original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua Tue Feb 
23 08:00:36 2010
@@ -475,7 +475,7 @@
                end
        end
 
-       _connectToAddr(self, serverip, nil)
+       _connectToAddr(self, serverip)
 end
 
 
@@ -509,6 +509,9 @@
                if opcode == 'test' then
                        return
                end
+
+               -- We got a packet so we must be connected
+               self.state = CONNECTED
 
                log:debug("read opcode=", opcode, " #", #data)
 
@@ -595,7 +598,6 @@
 
        -- connect
        self.socket:t_connect()
-       self.state = CONNECTED
        self.txqueue = {}
 
        -- SC and SN ping the player every 5 and 30 seconds respectively.
@@ -610,7 +612,7 @@
                (status.isStreaming or status.isLooping)
 
        -- send helo packet
-       self:send(self.heloPacket)
+       self:send(self.heloPacket, true)
 end
 
 
@@ -700,8 +702,8 @@
 
 -- Sent packet. Returns false is the connection is disconnected and the
 -- packet can't be sent, otherwise it returns true.
-function send(self, packet)
-       if self.state ~= CONNECTED then
+function send(self, packet, force)
+       if not force and self.state ~= CONNECTED then
                return false
        end
 

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua?rev=8556&r1=8555&r2=8556&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua 
(original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua Tue 
Feb 23 08:00:36 2010
@@ -193,8 +193,10 @@
        -- make sure the server we are connecting to is awake
        server:wakeOnLan()
 
-       if self:needsMusicSource() then
-               log:info('connectToServer(): connecting localPlayer to server', 
server, ' via slimproto')
+       -- Needs to be fully connected, both SlimProto and Comet connection 
before we can use server connection
+       -- Otherwise, just do it locally
+       if not self:isConnected() then
+               log:info('connectToServer(): connecting localPlayer to server', 
server, ' via internal call')
 
                -- close any previous connection
                self.slimproto:disconnect()
@@ -230,8 +232,19 @@
 end
 
 
+-- Alan Young, 20100223 - I do not understand why the local player's 
+-- isConnected method only took into account the state of the Slimproto
+-- connection and ignored whether any server that we know about has reported 
that the
+-- player is connected.
+--
+-- If, however, someone comes back to this and decides that should be like 
that after all,
+-- then connectToServer() needs to be changed to use 
+-- "Player.isConnected(self) and self.slimproto:isConnected()", 
+-- instead of self:isConnected() as the test to determine whether or not the 
server
+-- can be used to tell the player to switch servers.
+
 function isConnected(self)
-       return self.slimproto:isConnected()
+       return self.slimproto:isConnected() and Player.isConnected(self)
 end
 
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to