Skip to content

Commit

Permalink
remove greetings
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 12, 2012
1 parent 4d6c60b commit 0bc9929
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions lib/sockets/sock.js
Expand Up @@ -37,7 +37,6 @@ function Socket() {
this.opts = {};
this.server = null;
this.socks = [];
this.map = {};
this.settings = {};
this.format('none');
this.set('identity', String(process.pid));
Expand Down Expand Up @@ -143,11 +142,10 @@ Socket.prototype.close = function(){
*/

Socket.prototype.address = function(){
if (this.server) {
var addr = this.server.address();
addr.string = 'tcp://' + addr.address + ':' + addr.port;
return addr;
}
if (!this.server) return;
var addr = this.server.address();
addr.string = 'tcp://' + addr.address + ':' + addr.port;
return addr;
};

/**
Expand Down Expand Up @@ -176,22 +174,8 @@ Socket.prototype.addSocket = function(sock){
, parser = new Parser
, n = this.socks.push(sock);

// send our greeting
sock.write(this.pack(this.get('identity')));

// parse incoming
sock.on('data', parser.write.bind(parser));

// accept greeting once, emit messages there on out
parser.onmessage = ongreeting;

function ongreeting(msg){
var id = String(msg);
if ('0' === id) id = pid + Date.now() + n;
sock._axon_id = id;
self.map[id] = sock;
parser.onmessage = self.onmessage(sock);
}
parser.onmessage = self.onmessage(sock);
};

/**
Expand Down

0 comments on commit 0bc9929

Please sign in to comment.