From 69fe844f9b8c5f4401b81c654cd36593b312eb74 Mon Sep 17 00:00:00 2001 From: Marshall Rose Date: Thu, 29 May 2014 14:00:22 -0400 Subject: [PATCH] fix timeout calculation when subscription fails for UPnP audio --- steward/devices/devices-media/media-audio-sonos.js | 10 ++++++++-- steward/devices/devices-media/media-audio-upnp.js | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/steward/devices/devices-media/media-audio-sonos.js b/steward/devices/devices-media/media-audio-sonos.js index 13dc3fdf..b288f6a6 100644 --- a/steward/devices/devices-media/media-audio-sonos.js +++ b/steward/devices/devices-media/media-audio-sonos.js @@ -75,15 +75,21 @@ Sonos_Audio.prototype.jumpstart = function(self, path) { , headers : stringify(response.headers) }); +// Sonos DOCK + if ((response.statusCode === 500) && (self.sid === null) && (!response.headers.sid)) { + logger.error('device/' + self.deviceID, { event: 'subscribe', diagnostic: 'subscribe not available' }); + return; + } + if (!!err) { self.error(self, err, 'subscribe'); - setTimeout(function() { self.jumpstart(self, path); }, secs * 30 * 1000); + setTimeout(function() { self.jumpstart(self, path); }, 30 * 1000); return; } if ((response.statusCode !== 200) || (!response.headers.sid)) { self.sid = null; - setTimeout(function() { self.jumpstart(self, path); }, secs * 30 * 1000); + setTimeout(function() { self.jumpstart(self, path); }, 30 * 1000); return; } diff --git a/steward/devices/devices-media/media-audio-upnp.js b/steward/devices/devices-media/media-audio-upnp.js index a4fbe72a..241c9ada 100644 --- a/steward/devices/devices-media/media-audio-upnp.js +++ b/steward/devices/devices-media/media-audio-upnp.js @@ -92,13 +92,13 @@ UPnP_Audio.prototype.jumpstart = function(self, path) { if (!!err) { self.error(self, err, 'subscribe'); - setTimeout(function() { self.jumpstart(self, path); }, secs * 30 * 1000); + setTimeout(function() { self.jumpstart(self, path); }, 30 * 1000); return; } if ((response.statusCode !== 200) || (!response.headers.sid)) { self.sid = null; - setTimeout(function() { self.jumpstart(self, path); }, secs * 30 * 1000); + setTimeout(function() { self.jumpstart(self, path); }, 30 * 1000); return; }