[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Calling close let other calls crash #22

Closed
StefanFu opened this issue Oct 12, 2016 · 4 comments
Closed

Calling close let other calls crash #22

StefanFu opened this issue Oct 12, 2016 · 4 comments

Comments

@StefanFu
Copy link
Contributor

Hi,

In my app I'm searching for device with ZeroConf.watch(...). After a timeout I called ZeroConf.close() to stop the service. When I now try to call the ZeroConf.watch(...) again the app crashes. The reason for that is that in ZeroConf.java the jmdns is not set to null.

Here my fix which is working:
...
} else if (action.equals("close")) {
if (jmdns != null) {
try {
jmdns.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
jmdns = null;
}
}
} else if (action.equals("unregister")) {
...

I can call unwatch and than it's working. But when I change the WLAN the I cannot find devices in the new network because we initialize the ZeroConf with an IP.

@StefanFu StefanFu changed the title Calling close let other calls crach Calling close let other calls crash Oct 12, 2016
@StefanFu
Copy link
Contributor Author

By the way the method close() can block for a long time. Should may also run in a separate Runnable

@vstirbu
Copy link
Owner
vstirbu commented Oct 13, 2016

Android growing up pains are visible all over this plugin. It has not been updated for a long time and definitely improvements should be brought in, and in fact would be welcome.

StefanFu added a commit to StefanFu/ZeroConf that referenced this issue Oct 14, 2016
@StefanFu
Copy link
Contributor Author

I forked the project and pushed my changes. Feel free to merge it or can/should I do that?

@vstirbu
Copy link
Owner
vstirbu commented Oct 14, 2016

Thanks for fixing this issue. If you make a pull request I'll merge it and publish an update in npm.

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