From f6bd9e783298b0b5291008f304ccdb6daaa92ce8 Mon Sep 17 00:00:00 2001 From: Alexandre Tiertant Date: Fri, 5 May 2017 14:30:22 +0200 Subject: [PATCH 1/2] fix this.log is not a function --- dao/socketServer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dao/socketServer.js b/dao/socketServer.js index 35772e4..cd2e298 100644 --- a/dao/socketServer.js +++ b/dao/socketServer.js @@ -259,6 +259,7 @@ function serverCreated(socket) { } function startServer() { + var self = this; this.log( 'starting server on ',this.path, ((this.port)?`:${this.port}`:'') @@ -289,9 +290,9 @@ function startServer() { this.server.on( 'error', function(err){ - this.log('server error',err); + self.log('server error',err); - this.publish( + self.publish( 'error', err ); From fdfd13b98f377b0ee75dc0ff1ddf9ebdf895dfd6 Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Thu, 18 May 2017 14:22:56 -0700 Subject: [PATCH 2/2] binding this is better for garbage collection. --- dao/socketServer.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dao/socketServer.js b/dao/socketServer.js index cd2e298..b192b41 100644 --- a/dao/socketServer.js +++ b/dao/socketServer.js @@ -259,7 +259,6 @@ function serverCreated(socket) { } function startServer() { - var self = this; this.log( 'starting server on ',this.path, ((this.port)?`:${this.port}`:'') @@ -290,13 +289,13 @@ function startServer() { this.server.on( 'error', function(err){ - self.log('server error',err); + this.log('server error',err); - self.publish( + this.publish( 'error', err ); - } + }.bind(this) ); this.server.maxConnections=this.config.maxConnections;