Author: bklaas
Date: Tue Jan 12 14:36:56 2010
New Revision: 8321

URL: http://svn.slimdevices.com/jive?rev=8321&view=rev
Log:
 r38...@daddymac-520 (orig r8317):  bklaas | 2010-01-12 10:58:35 -0500
 Bug: 14870
 Description: For now, pull all log messages out of (if self.localPlayer) 
clauses.
 remove 59 second alarm window hide timer
 remove streamSuccessChecker, as it is replaced by the decodeState poller
 
 r38...@daddymac-520 (orig r8319):  felix | 2010-01-12 13:54:13 -0500
 Bug: 11455 
 Description:  
 - Reduced DNS timeout to 10 seconds (was 2 minutes). My tests on Jive, Baby 
and Touch showed that a 10 seconds timeout is still enough to allow the message 
pipe to empty even if a lot of DNS resolve requests are queued up while the 
network is down.
 - Fixed slow memory leak in DNS resolver thread (occured while the network was 
down)
 
 r38...@daddymac-520 (orig r8320):  bklaas | 2010-01-12 16:33:59 -0500
 Bug: 14870
 Description: use decode:status().audioState to check if something's currently 
playing. LocalPlayer:isStreaming() is not the correct check, nor is 
decode:status().decodeState
 

Modified:
    7.5/trunk/   (props changed)
    
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
    7.5/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c

Propchange: 7.5/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Tue Jan 12 14:36:56 2010
@@ -12,7 +12,7 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-autoswitch:5831
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-skin:4552
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8312
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8320
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua?rev=8321&r1=8320&r2=8321&view=diff
==============================================================================
--- 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 (original)
+++ 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 Tue Jan 12 14:36:56 2010
@@ -70,20 +70,11 @@
                        end,
                        true
        )
-       self.streamSuccessChecker = Timer(20000,
-                       function ()
-                               if self.alarmInProgress == 'server' and not 
self.localPlayer:isStreaming() then
-                                       self:soundFallbackAlarm()
-                               end
-                       end,
-                       true
-       )
        
        if startTimer then
                self:_startTimer()
        end
 
-       self.debugDecodeState = true
        self.decodeStatePoller = Timer(10000, 
                function ()
                        self:_pollDecodeState()
@@ -96,6 +87,7 @@
 
 function notify_playerAlarmState(self, player, alarmState, alarmNext)
 
+       log:warn('notify_playerAlarmState received for ', player, ' with 
alarmState of ', alarmState)
        if player:isLocal() then
                log:warn('**************************** notify_playerAlarmState 
received: ', alarmState, ' ', alarmNext)
                if alarmState == 'active' then
@@ -193,14 +185,15 @@
        if self.alarmInProgress == 'server' then
                local status = decode:status()
                -- just informational
-               log:warn('alarm_sledgehammerRearm(', caller,'): SERVER alarm in 
progress - decodeState is ', status.decodeState, ' and streaming is ', 
self.localPlayer:isStreaming())
+               log:warn('alarm_sledgehammerRearm(', caller,'): SERVER alarm in 
progress - audioState is ', status.audioState)
                
-               if not self.localPlayer:isStreaming() then
+               if not status.audioState == 1 then
                        log:warn('alarm_sledgehammerRearm(', caller,'): SERVER 
alarm in progress, but stream is nil - firing fallback alarm')
                        hammer = true
                end
        -- restart audio on any state transition from SqueezeOS, but not on 
local polls 
-       elseif self.alarmInProgress == 'rtc' and caller ~= '_pollDecodeState' 
then
+       --elseif self.alarmInProgress == 'rtc' and caller ~= '_pollDecodeState' 
then
+       elseif self.alarmInProgress == 'rtc' then
                log:warn('alarm_sledgehammerRearm(', caller,'): RTC alarm 
already in progress - restarting alarm audio asynchronously')
                hammer = true
        end
@@ -226,8 +219,8 @@
 -- polling would eventually manifest the transition anyway...
 
 function notify_playerLoaded(self, player)
+       log:info("notify_playerLoaded(", player, ")")
        if player == self.localPlayer then
-               log:info("notify_playerLoaded(", player, ")")
 --             self:_alarm_sledgehammerRearm('notify_playerLoaded')
                -- check for pending server alarm in case that one is pending 
instead, since we may have changed players to force 
                --       local control during a previous call to 
openAlarmWindow()
@@ -239,33 +232,31 @@
 
 
 function notify_playerCurrent(self, player)
+       log:info("notify_playerCurrent(", player, ")")
        if player == self.localPlayer then
-               log:info("notify_playerCurrent(", player, ")")
 --             self:_alarm_sledgehammerRearm('notify_playerCurrent')
        end
 end
 
 
 function notify_playerModeChange(self, player, mode)
+       log:warn('notify_playerModeChange: player (', player,') mode has been 
changed to ', mode)
+       local status = decode:status()
+       log:warn('notify_playerModeChange: - audioState is ', status.audioState)
+end
+
+
+function notify_playerConnected(self, player)
+       log:warn('notify_playerConnected: ', player, ' ', self.alarmInProgress)
        if player == self.localPlayer then
-               log:warn('notify_playerModeChange: player (', player,') mode 
has been changed to ', mode)
-               local status = decode:status()
-               log:warn('notify_playerModeChange: - decodeState is ', 
status.decodeState,' and streaming is ', self.localPlayer:isStreaming())
-       end
-end
-
-
-function notify_playerConnected(self, player)
+--             self:_alarm_sledgehammerRearm('notify_playerConnected')
+       end
+end
+
+
+function notify_playerDisconnected(self, player)
+       log:warn('notify_playerDisconnected ', player, self.alarmInProgress)
        if player == self.localPlayer then
-               log:warn('notify_playerConnected: ', player, ' ', 
self.alarmInProgress)
---             self:_alarm_sledgehammerRearm('notify_playerConnected')
-       end
-end
-
-
-function notify_playerDisconnected(self, player)
-       if player == self.localPlayer then
-               log:warn('notify_playerDisconnected ', player, 
self.alarmInProgress)
        end
 end
 
@@ -348,9 +339,9 @@
 function _pollDecodeState(self)
        local status = decode:status()
        if self.localPlayer:isConnected() then
-               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
decodeState is ', status.decodeState, ' and streaming is ', 
self.localPlayer:isStreaming())
-       else
-               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
decodeState is ', status.decodeState, ' and no current player')
+               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
audioState is ', status.audioState)
+       else
+               log:warn('_pollDecodeState(',self.alarmInProgress,'): 
audioState is ', status.audioState)
        end
 
        self:_alarm_sledgehammerRearm('_pollDecodeState')       
@@ -403,7 +394,7 @@
                -- just informational stuff for now
                local status = decode:status()
                -- just informational
-               log:warn('openAlarmWindow: called with `server` - decodeState 
is ', status.decodeState, ' and streaming is ', self.localPlayer:isStreaming())
+               log:warn('openAlarmWindow: called with `server` - audioState is 
', status.audioState)
 
                if self.alarmInProgress == 'rtc' then
                        log:warn('openAlarmWindow: called with `server` while 
`rtc` alarm in progress!')
@@ -411,19 +402,10 @@
                        log:error('CALL STACK TRAP: ')
                end
                
-               if self.debugDecodeState then
-                       if self.decodeStatePoller:isRunning() then
-                               self.decodeStatePoller:restart()
-                       else
-                               self.decodeStatePoller:start()
-                       end
-               end
-
-               if not self.localPlayer:isStreaming() then
-                       -- check in 20 secs if we are streaming anything, and 
if not, fire fallback alarm
-                       -- this used to be done server-side, but that has been 
removed
-                       log:info('openAlarmWindow: starting stream success 
check timer. in 20 seconds if alarm is still active and stream has failed, 
client-side fallback alarm will be fired')
-                       self.streamSuccessChecker:start()
+               if self.decodeStatePoller:isRunning() then
+                       self.decodeStatePoller:restart()
+               else
+                       self.decodeStatePoller:start()
                end
 
 
@@ -505,9 +487,6 @@
 
        menu:setHeaderWidget(headerGroup)
 
-        -- the alarm notification window should not endure forever; hide after 
59 seconds
-        window:addTimer(59000, function() self:_hideAlarmWindow() end)
-
        window:addWidget(menu)
        window:setShowFrameworkWidgets(false)
        window:setAllowScreensaver(false)

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c?rev=8321&r1=8320&r2=8321&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/src/net/jive_dns.c Tue Jan 12 
14:36:56 2010
@@ -23,7 +23,22 @@
 
 #endif
 
-#define RESOLV_TIMEOUT (2 * 60 * 1000) /* 2 minutes */
+/* fm - 01/12/2010
+Userland DNS resolve requests are queued into a pipe in jiveL_dns_write(), then
+dns_resolver_thread() reads the pipe and calls gethostbyaddr() or 
gethostbyname().
+Both of these functions are blocking and can take a couple of seconds to 
return,
+especially if the network is down.
+To allow the pipe to empty if a lot of DNS requests are issued while the 
network
+is down a 'shortcut' is taken as long as the following timeout is active. The
+shortcut path doesn't call the blocking functions but just reads from the pipe
+and returns the last error code again.
+The timeout was set to 2 minutes which I found in my tests on Jive, Baby and
+Touch not to be necessary to make sure the pipe gets emptied. 10 seconds seem
+to be enough.
+The 10 seconds timeout also makes reconnecting a lot quicker when the network 
is
+re-established. 
+*/
+#define RESOLV_TIMEOUT (10 * 1000) /* 10 seconds (was 2 minutes) */
 
 
 /*
@@ -208,6 +223,7 @@
                        
                        if (now - failed_timeout < RESOLV_TIMEOUT) {
                                write_str(fd, failed_error);
+                               free(buf);
                                continue;
                        }
                }

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

Reply via email to