Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use upnode listeners for symmetric pings

  • Loading branch information...
commit 67d852c7a4df1939c2685fd2c894c5997f41d85a 1 parent 6cfc253
@substack authored
Showing with 17 additions and 6 deletions.
  1. +15 −3 index.js
  2. +2 −3 package.json
View
18 index.js
@@ -1,5 +1,4 @@
var upnode = require('upnode');
-var dnode = require('dnode');
var semver = require('semver');
var EventEmitter = require('events').EventEmitter;
@@ -95,7 +94,7 @@ exports.createServer = function (opts) {
if (!opts) opts = {};
if (!opts.range) opts.range = { '*' : [ 10000, 20000 ] } ;
- var server = dnode(function (remote, conn) {
+ var up = upnode(function (remote, conn) {
if (!opts.secret) return service(remote, conn);
this.auth = function (secret, cb) {
@@ -103,6 +102,20 @@ exports.createServer = function (opts) {
else cb('ACCESS DENIED')
};
});
+ var server = new EventEmitter;
+ server._servers = [];
+ server.up = server;
+
+ server.close = function () {
+ server._servers.forEach(function (s) {
+ s.close();
+ });
+ };
+
+ server.listen = function () {
+ server._servers.push(up.listen.apply(up, arguments));
+ return server;
+ };
var ports = server.ports = {};
var roles = server.roles = {};
@@ -314,6 +327,5 @@ exports.createServer = function (opts) {
}
};
- server.use(upnode.ping);
return server;
};
View
5 package.json
@@ -1,7 +1,7 @@
{
"name" : "seaport",
"description" : "service registry and port assignment for clusters",
- "version" : "0.6.4",
+ "version" : "0.6.5",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/seaport.git"
@@ -27,8 +27,7 @@
"test" : "tap test/*.js"
},
"dependencies" : {
- "dnode" : "0.9.x",
- "upnode" : "0.1.x",
+ "upnode" : "~0.2.0",
"optimist" : "0.3.x",
"semver" : "1.0.x"
},
Please sign in to comment.
Something went wrong with that request. Please try again.