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

upnp.stopDiscovery() not called #1

Closed
svencan opened this issue Jul 29, 2016 · 1 comment
Closed

upnp.stopDiscovery() not called #1

svencan opened this issue Jul 29, 2016 · 1 comment

Comments

@svencan
Copy link

svencan commented Jul 29, 2016

I have a Cordova project with JXCore using this node module.

UPNP discovery basically works, I listen for devices and I can start the discovery. However, stopDiscovery() doesn't seem to work. After starting the discovery, I set a timeout like so:

setTimeout(function() {
    Mobile('debug').call('Attempt to stop discovery');
    upnp.stopDiscovery(function() {
        Mobile('debug').call('Discovery stopped');
        callback({info: 'Stopped scanning'});
        process.exit();
    });
}, seconds * 1000);

Mobile('debug').call('Attempt to stop discovery'); eventually prints the string to the console, so the timeout works. But the callback given to upnp.stopDiscovery() is not executed. Furthermore I can't start the process again without completely restarting the app.

Any idea how to fix this?

Edit: I narrowed it down a bit. In node-upnp-utils.js in the stopDiscovery function, none of the callbacks given to this.sockets[...].close() are executed. For the moment I cannot debug it further than that.

@futomi
Copy link
Owner

futomi commented Jul 29, 2016

Thanks for your feedback.

I examined the issue using JXcore.
https://github.com/jxcore/jxcore-release

I found that JXcore is based on Node.js 0.10.40 which is too old to use the node-upnp-utils.

> process.versions;
{ http_parser: '1.0',
  node: '0.10.40',
  jxcore: '0.3.1.1',
  ch: 0,
  v8: '3.14.5.9',
  sm: 0,
  embedded: { sqlite: '3.9.1' },
  ares: '1.9.0-DEV',
  uv: '0.10.36',
  zlib: '1.2.3',
  modules: '11',
  openssl: '1.0.1p' }
>

The node-upnp-utils was developed for Node.js 4+. JXcore based on Node.js 0.10 does not support the arrow function syntax (i.e. (param1, param2, …, paramN) => { statements }) specified in ECMAScript 2015.

I'm afraid that I'm not planning to support older versions of Node than 4. Sorry.

@futomi futomi closed this as completed Jul 29, 2016
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