Permalink
Browse files

expose createStream

  • Loading branch information...
1 parent b32b5f1 commit a91dfc464d8e3b0942bc2eaae2397f4c814a4657 @substack committed Aug 6, 2012
Showing with 12 additions and 3 deletions.
  1. +10 −1 index.js
  2. +2 −2 package.json
View
@@ -30,9 +30,13 @@ function Airport (ports, cons) {
this.cons = cons;
}
-Airport.prototype.connect = function (role, fn) {
+Airport.prototype.connect = function (opts, fn) {
var ports = this.ports;
var cons = this.cons;
+ if (typeof opts === 'string') {
+ opts = { role : opts };
+ }
+ var role = opts.role;
function ondown () {
ports.get(role, onget);
@@ -43,6 +47,7 @@ Airport.prototype.connect = function (role, fn) {
ports.removeListener('down', ondown);
var s = pick(ps);
+
if (res) res.destroy();
res = connector(s, function f (s_) {
if (res) res.destroy();
@@ -61,6 +66,10 @@ Airport.prototype.connect = function (role, fn) {
function connector (service, cb) {
var inst = upnode(cons);
var c;
+ if (opts.createStream) {
+ service.createStream = opts.createStream;
+ }
+
if (service.secret) {
c = inst.connect(service, function (remote, conn) {
if (typeof remote.secret === 'function') {
View
@@ -1,7 +1,7 @@
{
"name" : "airport",
"description" : "role-based port management for upnode",
- "version" : "0.4.0",
+ "version" : "0.4.1",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/airport.git"
@@ -22,7 +22,7 @@
"test" : "tap test/*.js"
},
"dependencies" : {
- "upnode" : "~0.3.1",
+ "upnode" : "~0.4.1",
"deck" : "~0.0.4",
"seaport" : "~0.8.0"
},

0 comments on commit a91dfc4

Please sign in to comment.