Index: src/squeezeplay/share/jive/slim/LocalPlayer.lua =================================================================== --- src/squeezeplay/share/jive/slim/LocalPlayer.lua (revision 8550) +++ src/squeezeplay/share/jive/slim/LocalPlayer.lua (working copy) @@ -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,9 +232,19 @@ end -function isConnected(self) - return self.slimproto:isConnected() -end +-- Alan Young, 20100223 - I do not understand why the local player needs its +-- own isConnected method that only takes into account the state of the Slimproto +-- connection and ignores whether any server that we know about has reported that the +-- player is connected. +-- +-- If, however, someone comes back to this and decides that this is needed after all, +-- then connectToServer() needs to be changed to use Player.isConnected(self), +-- 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() +-- end function setSignalStrength(self, signalStrength) Index: src/squeezeplay/share/jive/net/SlimProto.lua =================================================================== --- src/squeezeplay/share/jive/net/SlimProto.lua (revision 8547) +++ src/squeezeplay/share/jive/net/SlimProto.lua (working copy) @@ -510,6 +510,9 @@ return end + -- We got a packet so we must be connected + self.state = CONNECTED + log:debug("read opcode=", opcode, " #", #data) --_hexDump(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