Author: titmuss
Date: Sun Jan 27 12:08:20 2008
New Revision: 1646
URL: http://svn.slimdevices.com?rev=1646&root=Jive&view=rev
Log:
Bug: 6761
Description:
Added debug in NetworkThread to allow notify() calls to be easily watched.
Fixed the firmware upgrade meta file to unsubscribe from firmware notifications
correctly.
Modified:
branches/7.0/jive/src/pkg/jive/share/jive/net/NetworkThread.lua
branches/7.0/jive/src/pkg/jive_squeezeboxjive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeMeta.lua
Modified: branches/7.0/jive/src/pkg/jive/share/jive/net/NetworkThread.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/jive/net/NetworkThread.lua?rev=1646&root=Jive&r1=1645&r2=1646&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/jive/net/NetworkThread.lua (original)
+++ branches/7.0/jive/src/pkg/jive/share/jive/net/NetworkThread.lua Sun Jan 27
12:08:20 2008
@@ -29,7 +29,7 @@
-- stuff we use
-local _assert, tostring, table, ipairs, pairs, pcall, type = _assert,
tostring, table, ipairs, pairs, pcall, type
+local _assert, tostring, table, ipairs, pairs, pcall, select, type = _assert,
tostring, table, ipairs, pairs, pcall, select, type
local socket = require("socket")
local coroutine = require("coroutine")
@@ -237,7 +237,12 @@
-- notify
function notify(self, event, ...)
--- log:info("NetworkThread:notify(", event, ")")
+ -- detailed logging for events
+ local a = {}
+ for i=1, select('#', ...) do
+ a[i] = tostring(select(i, ...))
+ end
+ log:info("NOTIFY ", event, ": ", table.concat(a, ", "))
local method = "notify_" .. event
Modified:
branches/7.0/jive/src/pkg/jive_squeezeboxjive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeMeta.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive_squeezeboxjive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeMeta.lua?rev=1646&root=Jive&r1=1645&r2=1646&view=diff
==============================================================================
---
branches/7.0/jive/src/pkg/jive_squeezeboxjive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeMeta.lua
(original)
+++
branches/7.0/jive/src/pkg/jive_squeezeboxjive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeMeta.lua
Sun Jan 27 12:08:20 2008
@@ -1,5 +1,5 @@
-local tonumber = tonumber
+local error, tonumber = error, tonumber
local oo = require("loop.simple")
@@ -28,10 +28,6 @@
function registerApplet(meta)
- -- Wifi uses its own log category
- -- defined here so that it can be changed using LogSettingsApplet
before the applet is run.
- jul.addCategory("applet.wifi", jul.DEBUG)
-
jiveMain:addItem(meta:menuItem('appletSetupFirmwareUpgrade',
'advancedSettings', "UPDATE", function(applet) applet:settingsShow() end))
-- check for firmware upgrades when we connect to a new player
@@ -39,7 +35,6 @@
-- do this in a closure
local firmwareUpgradeSink =
function(chunk, err)
- log:warn("FIRMWARE SINK")
if err then
log:warn(err)
return
@@ -48,24 +43,19 @@
-- store firmware upgrade url
if chunk.data.firmwareUrl then
upgradeUrl[1] = chunk.data.firmwareUrl
+ log:info("Firmware URL=", upgradeUrl[1])
end
-- are we forcing an upgrade
if tonumber(chunk.data.firmwareUpgrade) == 1 then
- log:warn("New Firmware Available")
+ log:info("Force firmware upgrade")
local applet =
appletManager:loadApplet("SetupFirmwareUpgrade")
applet:forceUpgrade(upgradeUrl[1])
- --FIXME, the unsubscriptions do not work
- if player then
- log:warn("Unsubscribing from
/slim/firmwarestatus/", player.id)
-
player.slimServer.comet:unsubscribe('/slim/firmwarestatus/' .. player.id)
+
+ if meta.player then
+ log:warn("Unsubscribing from
/slim/firmwarestatus/", self.player.id)
+
meta.player.slimServer.comet:unsubscribe('/slim/firmwarestatus/' ..
meta.player.id)
end
- if self and self.player then
- log:warn("Unsubscribing from
/slim/firmwarestatus/", self.player.id)
-
self.player.slimServer.comet:unsubscribe('/slim/firmwarestatus/' ..
self.player.id)
- end
- else
- log:warn("no new firmware needed")
end
end
@@ -74,28 +64,29 @@
notify_playerCurrent =
function(self, player)
log:warn("PLAYER CURRENT!!")
- --FIXME, the unsubscription does not work
- if self.player and player and self.player ~=
player then
- log:warn("Unsubscribing from
/slim/firmwarestatus/", self.player.id)
-
self.player.slimServer.comet:unsubscribe('/slim/firmwarestatus/' ..
self.player.id)
+
+ if not player then
+ -- should never happen
+ error("No player")
end
- if player then
- local fwcmd = { 'firmwareupgrade',
'firmwareVersion:' .. JIVE_VERSION, 'subscribe:3600' }
- player.slimServer.comet:subscribe(
- '/slim/firmwarestatus/' ..
player.id,
- firmwareUpgradeSink,
- player.id,
- fwcmd
- )
+ if meta.player and meta.player ~= player then
+ log:warn("Unsubscribing from
/slim/firmwarestatus/", meta.player)
+
meta.player.slimServer.comet:unsubscribe('/slim/firmwarestatus/' ..
meta.player.id)
end
+
+ log:warn("SUB ", player)
+
+ meta.player = player
+
+ local fwcmd = { 'firmwareupgrade',
'firmwareVersion:' .. JIVE_VERSION, 'subscribe:3600' }
+ player.slimServer.comet:subscribe(
+ '/slim/firmwarestatus/' .. player.id,
+ firmwareUpgradeSink,
+ player.id,
+ fwcmd
+ )
end,
- notify_playerDisconnect =
- function(self,player)
- if player then
-
player.slimServer.comet:unsubscribe('/slim/firmwarestatus/' .. player.id)
- end
- end
}
jnt:subscribe(monitor)
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins