Closed aledbf closed 11 years ago
Interesting. I hadn't actually tested this, but my original intent was to be able to use different keys while on the same port.
I had assumed that one instance decrypting with the wrong key would throw an error and that I would catch that error. It seems that since I did not actually test all of my assumptions that I never ended up try/catching or binding to an error event in the decrypt function (https://github.com/wankdanker/node-discover/blob/master/lib/network.js#L176).
I think we should be able to fix this pretty easily.
What version of node are you using? I just tested this as is and it works as expected without any additional error checking.
I'm using node v0.10.13
Hi, I tried v0.10.13 and v0.10.16
To reproduce the error:
key1.js
var Discovery = require('node-discovery').Discovery;
var c = new Discovery({
key: 'key1',
weight:1
});
c.on('promotion', function() {
console.log('I was promoted.');
});
c.on('demotion', function() {
console.log('I was demoted.');
});
c.on('master', function(obj) {
console.log('New master.');
});
key2.js
var Discovery = require('node-discovery').Discovery;
var c = new Discovery({
key: 'key2',
weight:1
});
c.on('promotion', function() {
console.log('I was promoted.');
});
c.on('demotion', function() {
console.log('I was demoted.');
});
c.on('master', function(obj) {
console.log('New master.');
});
Oh, it looks like you are using node-discovery
which is a fork of this project by @skeggse. A lot of stuff has changed on that fork and is beyond me to fix it.
If you install with npm install node-discover
, it will probably work for you. But will be missing whatever features @skeggse has added in node-discovery
.
I'm sorry, my fault. Like you said, your version works fine (and the error is in the fork)
No worries! Cheers!
I don't know if this an error or the desired behavior for node-discover:
I have at least 2 apps with multiple instances with different keys (the rest of the conf is the same). I get this error:
I know that if I set different ports this works fine but if that's the case i need one additional port per app instead of just one for discovery? Thanks.