Skip to content

Commit

Permalink
fix to connect even over seaport server interrupts
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Jan 28, 2012
1 parent 9e297a2 commit 1535faf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ var seaport = module.exports = function (env) {
env_ = env;
}

self.wait(role, function (ps) {
function ondown () {
self.wait(role, onwait);
}
self.wait(role, onwait);

function onwait (ps) {
up.removeListener('down', ondown);

var inst = upnode.apply(null, args);
res = inst.connect(ps[0].host, ps[0].port, fn);

target.close = res.close.bind(inst);
queue.forEach(function (cb) { res(cb) });
});
}
up.on('down', ondown);

var res;
var queue = [];
Expand Down

0 comments on commit 1535faf

Please sign in to comment.