Permalink
Browse files

major bug fix: recent versions of node do not allow access to socket.…

…fd anymore,

which we were using as a connection id so the server could keep track of
clients. we'll just use an autoincrement now.
  • Loading branch information...
1 parent 4a3e8fe commit 1985b084f7f834a131fc8f34d0ca83cffea195c8 @bjyoungblood bjyoungblood committed Jan 4, 2012
Showing with 2 additions and 1 deletion.
  1. +0 −1 lib/server-connection.js
  2. +2 −0 lib/server.js
View
@@ -29,7 +29,6 @@ var net = require('net'),
var serverConnection = function(socket, server, closeConnectionServerCallback, callbacks) {
var self = this;
- self.connection_id = socket.fd;
self.socket = socket;
self.sequence_number = 1;
self.bound = false;
View
@@ -31,6 +31,7 @@ exports.server = function(config) {
self.server = {};
self.clients = [];
self.started = false;
+ self.connections = 0;
self.eventListeners = [];
self.on('newListener', function(event, listener) {
@@ -85,6 +86,7 @@ exports.server = function(config) {
self.connectionListener = function(incomingSocket) {
// add a client and keep track of it
var myClient = client.fromSocket(incomingSocket, self, self.clientCloseHandler);
+ myClient.connection_id = self.connections++;
for (var i = 0; i < self.eventListeners.length; i++) {
myClient.on(self.eventListeners[i].event, self.eventListeners[i].listener);

0 comments on commit 1985b08

Please sign in to comment.