Server: Removing console.logs, comments, formatting
authorDarren <darren@darrenwhitlen.com>
Mon, 29 Oct 2012 20:02:46 +0000 (20:02 +0000)
committerDarren <darren@darrenwhitlen.com>
Mon, 29 Oct 2012 20:02:46 +0000 (20:02 +0000)
server/client.js
server/kiwi.js

index a020f8972a3caff92af7498b1b5ee60cf1997150..1dc47e25189a929f0cf049afc2d2dea1faed30f2 100755 (executable)
@@ -13,7 +13,11 @@ var Client = function (websocket) {
     
     events.EventEmitter.call(this);
     this.websocket = websocket;
+
+    // Clients address
     this.real_address = this.websocket.handshake.real_address;
+
+    // A hash to identify this client instance
     this.hash = crypto.createHash('sha256').update(this.real_address).update('' + Date.now()).digest('hex');
     
     this.irc_connections = [];
index 1c9fd8274e2479c027d0f62fa36aeea9e7b4bb09..1a4d3130e65baa8e2551b36f977545f43803e39c 100755 (executable)
@@ -56,13 +56,11 @@ if ((!config.get().servers) || (config.get().servers.length < 1)) {
 
 
 
-/*
- * Web listeners
- */
-
 // Holder for all the connected clients
-global.clients = { clients: Object.create(null),
+global.clients = {
+    clients: Object.create(null),
     addresses: Object.create(null),
+
     add: function (client) {
         this.clients[client.hash] = client;
         if (typeof this.addresses[client.real_address] === 'undefined') {
@@ -70,6 +68,7 @@ global.clients = { clients: Object.create(null),
         }
         this.addresses[client.real_address][client.hash] = client;
     },
+
     remove: function (client) {
         if (typeof this.clients[client.hash] !== 'undefined') {
             delete this.clients[client.hash];
@@ -79,6 +78,7 @@ global.clients = { clients: Object.create(null),
             }
         }
     },
+
     numOnAddress: function (addr) {
         if (typeof this.addresses[addr] !== 'undefined') {
             return Object.keys(this.addresses[addr]).length;
@@ -88,17 +88,24 @@ global.clients = { clients: Object.create(null),
     }
 };
 
+
+
+
+/*
+ * Web listeners
+ */
+
+
 // Start up a weblistener for each found in the config
 _.each(config.get().servers, function (server) {
     var wl = new WebListener(server, config.get().transports);
+    
     wl.on('connection', function (client) {
         clients.add(client);
-        console.log(clients);
     });
+
     wl.on('destroy', function (client) {
         clients.remove(client);
-        //client.dispose();
-        console.log(clients);
     });
 });