Skip to content

Zeroconf ApiServer#128

Merged
devgianlu merged 5 commits intolibrespot-org:masterfrom
fiechtor:zeroconf-apiserver
Sep 10, 2019
Merged

Zeroconf ApiServer#128
devgianlu merged 5 commits intolibrespot-org:masterfrom
fiechtor:zeroconf-apiserver

Conversation

@fiechtor
Copy link
Copy Markdown
Contributor

@fiechtor fiechtor commented Sep 9, 2019

I noticed the Zeroconf server couldn't be used with the ApiServer. This PR adds that functionality.

Changes:

  • ZeroconfServer now has a interface SessionListener, to notify any listeners for a Session change
  • ZeroconfServer now contains a list of SessionListener; notifies listeners when a new Session is authenticated
  • Add method ApiServer.clearHandlers(); clears the ApiHandlers Map when a new Session is presented
  • Add class ZeroconfApiServer, extends ApiServer implements SessionListener; listens for changes in the ZeroconfServer's Session, clears old request handlers and registers new ones when a new Session is presented

xyz.gianlu.librespot.core.ZeroconfServer now extends java.util.Observable, notifies observers when a new Session is created
add method xyz.gianlu.librespot.api.server.ApiServer.clearHandlers(), clears the ApiHandlers Map
add class ZeroconfApiServer, extends xyz.gianlu.librespot.api.server.ApiServer, observes the ZeroconfServer, updates when a new Session is created in ZeroconfServer
Session had to be authenticated before registering request handlers
@devgianlu
Copy link
Copy Markdown
Member

Observer and Observable have been deprecated for this reason. Could your redo it with listeners?

Observer and Observable is deprecated in java 11+
@fiechtor
Copy link
Copy Markdown
Contributor Author

Silly me, fixed.

@devgianlu devgianlu merged commit fe90a7d into librespot-org:master Sep 10, 2019
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

Successfully merging this pull request may close these issues.

2 participants