Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unexpected discovery message #46

Closed
kopiro opened this issue Feb 10, 2022 · 4 comments
Closed

Error: Unexpected discovery message #46

kopiro opened this issue Feb 10, 2022 · 4 comments

Comments

@kopiro
Copy link
Contributor

kopiro commented Feb 10, 2022

Hey; I've implemented your library in https://github.com/kopiro/homebridge-playstation, and sometimes I'm getting:

Error: Unexpected discovery message:
    at Object.parseMessage (/usr/lib/node_modules/homebridge-playstation/node_modules/playactor/dist/discovery/messages.js:30:19)
    at Socket.<anonymous> (/usr/lib/node_modules/homebridge-playstation/node_modules/playactor/dist/discovery/udp.js:114:39)
    at Socket.emit (node:events:402:35)
    at UDP.onMessage (node:dgram:939:8)

This happens after connection.close() has been called and we call Device::withId().discover() again;

The weird thing is that this exception goes through the entire main thread and causes homebridge to crash

@dhleong
Copy link
Owner

dhleong commented Feb 10, 2022

Interesting. Not sure what's sending that invalid message, but we should definitely not crash. Should be easy enough to fix, just need to log and skip un-parseable messages in UdpDiscoveryNetworkFactory....

@kopiro
Copy link
Contributor Author

kopiro commented Feb 11, 2022

I may think this problem could happen whenever you do Device::withId() and immediately after you call .openConnection() WITHOUT calling .discover()

Solved it here: https://github.com/kopiro/homebridge-playstation/blob/master/src/playstationAccessory.ts#L99

@kopiro
Copy link
Contributor Author

kopiro commented Feb 20, 2022

@dhleong #49

@dhleong
Copy link
Owner

dhleong commented Feb 21, 2022

Fixed by #49 thanks!

@dhleong dhleong closed this as completed Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants