Skip to content

Commit

Permalink
Merge pull request #232 from mrose17/master
Browse files Browse the repository at this point in the history
fix timeout calculation when subscription fails for UPnP audio
  • Loading branch information
mrose17 committed May 29, 2014
2 parents 7469578 + 69fe844 commit 1e53cd4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions steward/devices/devices-media/media-audio-sonos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions steward/devices/devices-media/media-audio-upnp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1e53cd4

Please sign in to comment.