Skip to content
Snippets Groups Projects
Commit f6dd99cb authored by Neil's avatar Neil
Browse files

I kinda forgot what I did here... sorry for the bad commit message future self.

parent 1b6a170c
Branches master
No related tags found
No related merge requests found
......@@ -57,11 +57,10 @@ Proxy.prototype.clientConnected = function( client ) {
case PROTOCOL.CONTENT_CLIENTS:
console.log('\tRecieved request for list of [CLIENTS]');
// Send back a list of clients that are not currently connected to someone.
var unconnectedClients = "192.168.1.77\t192.168.1.23";
var unconnectedClients = "";
for (var key in Proxy.prototype.clientPool) {
if (Proxy.prototype.clientPool.hasOwnProperty(key)) {
var potentialClient = Proxy.prototype.clientPool[ key ];
// TODO: check that this client is yourself
if ( potentialClient.connectedTo === undefined )
unconnectedClients += "\t" + potentialClient.formattedAddress;
}
......@@ -132,7 +131,7 @@ Proxy.prototype.clientConnected = function( client ) {
if ( client.connectedTo !== undefined ) {
connectedToClient = Proxy.prototype.clientPool[ client.connectedTo ];
if ( connectedToClient )
connectedToClient.close();
connectedToClient.end();
Proxy.prototype.removeClient( connectedToClient );
}
Proxy.prototype.removeClient( client );
......@@ -154,9 +153,8 @@ Proxy.prototype.emitClientPool = function () {
for (var key in Proxy.prototype.clientPool) {
if (Proxy.prototype.clientPool.hasOwnProperty(key)) {
var potentialClient = Proxy.prototype.clientPool[ key ];
// TODO: check that this client is yourself
if ( potentialClient.connectedTo === undefined )
unconnectedClients += "\t" + potentialClient.formattedAddress;
unconnectedClients += "\t" + potentialClient.formattedAddress;
}
}
// 2. Now emit that list of clients to everyone not connected to someone
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment