{"action":"created","issue":{"url":"https://api.github.com/repos/jishi/node-sonos-discovery/issues/93","repository_url":"https://api.github.com/repos/jishi/node-sonos-discovery","labels_url":"https://api.github.com/repos/jishi/node-sonos-discovery/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/jishi/node-sonos-discovery/issues/93/comments","events_url":"https://api.github.com/repos/jishi/node-sonos-discovery/issues/93/events","html_url":"https://github.com/jishi/node-sonos-discovery/issues/93","id":181104705,"number":93,"title":"If local endpoint changes, subscribe will keep failing to reconnect.","user":{"login":"pfiaux","id":1199890,"avatar_url":"https://avatars.githubusercontent.com/u/1199890?v=3","gravatar_id":"","url":"https://api.github.com/users/pfiaux","html_url":"https://github.com/pfiaux","followers_url":"https://api.github.com/users/pfiaux/followers","following_url":"https://api.github.com/users/pfiaux/following{/other_user}","gists_url":"https://api.github.com/users/pfiaux/gists{/gist_id}","starred_url":"https://api.github.com/users/pfiaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfiaux/subscriptions","organizations_url":"https://api.github.com/users/pfiaux/orgs","repos_url":"https://api.github.com/users/pfiaux/repos","events_url":"https://api.github.com/users/pfiaux/events{/privacy}","received_events_url":"https://api.github.com/users/pfiaux/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-05T09:27:28Z","updated_at":"2016-10-06T12:47:15Z","closed_at":null,"body":"If the local end point changes, new ip is given by the router our such the subscribe call will throw a `EADDRNOTAVAIL` error. But since discovery.localEndpoint is only setup on init it will keep failing indefinitely or until restarted.\r\n\r\nI fixed this on a legacy branch: https://github.com/pfiaux/node-sonos-discovery/commit/67201ddfcb77594f3e95decfe67e8dd183412b8a\r\n\r\nI handled the EADDRNOTAVAIL specifically can updated the localEndpoint in that case. I looked quickly, I could be wrong but it seems like 1.0.0 on master still only does it on init as well:\r\nhttps://github.com/jishi/node-sonos-discovery/blob/master/lib/SonosSystem.js#L123"},"comment":{"url":"https://api.github.com/repos/jishi/node-sonos-discovery/issues/comments/251951145","html_url":"https://github.com/jishi/node-sonos-discovery/issues/93#issuecomment-251951145","issue_url":"https://api.github.com/repos/jishi/node-sonos-discovery/issues/93","id":251951145,"user":{"login":"pfiaux","id":1199890,"avatar_url":"https://avatars.githubusercontent.com/u/1199890?v=3","gravatar_id":"","url":"https://api.github.com/users/pfiaux","html_url":"https://github.com/pfiaux","followers_url":"https://api.github.com/users/pfiaux/followers","following_url":"https://api.github.com/users/pfiaux/following{/other_user}","gists_url":"https://api.github.com/users/pfiaux/gists{/gist_id}","starred_url":"https://api.github.com/users/pfiaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfiaux/subscriptions","organizations_url":"https://api.github.com/users/pfiaux/orgs","repos_url":"https://api.github.com/users/pfiaux/repos","events_url":"https://api.github.com/users/pfiaux/events{/privacy}","received_events_url":"https://api.github.com/users/pfiaux/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T12:47:15Z","updated_at":"2016-10-06T12:47:15Z","body":"No specific setup, just trying to be foolproof and cover edge cases. The silent failure is a problem, the subscriber using discovery can then have \"a dead player\" without knowing it. Perhaps wrapping the error if unhandled and forwarding it via `discovery.on('error', cb)` would allow the subscriber to chose to do something with it.\r\n\r\nIn this case I'm interested in keeping IP change handling encapsulated in node-sonos-discovery. My solution above works for the local endpoint.\r\n\r\nHowever like you said I run into a similar problem if the Sonos player changes IP. I'm looking into a way to try updating a player's address if the Sonos was to change IP. The error in this case would show up as `ETIMEDOUT` (in this case it could also be the sonos was turned off).\r\n\r\nThe sonos address is found in Discovery and it's passed to the Player as a constructor parameter. So either:\r\n* Discovery could start looking on the dgram socket again and create a new Player\r\n* Player could look (even via discovery) for it's specific device on a new IP and update its address when found\r\n\r\nI'm not sure which one would be the best approach. It looks like we can use the id from `/root/device/UDN` to find the same device (assuming the IP changed and it wasn't turned off)"}}
{"actor":{"display_login":"pfiaux"}}