Skip to content

Commit

Permalink
fixing bugs in tcpserver and connection
Browse files Browse the repository at this point in the history
  • Loading branch information
pbeardshear committed Jul 27, 2013
1 parent ac9546e commit 76cb59e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/connections/TCPConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ TCPConnection.drop = function () {
// Event listeners

TCPConnection.onMessage = function (data) {
//console.log('RECEIVED DATA MESSAGE:', data);

if (!this.onBeforeMessage()) {
return;
}

console.log('RECEIVED DATA MESSAGE:', data);

var payload = Buffer.isBuffer(data) ? data.toString() : data,
type = 'message';
// Try to parse the payload
Expand Down
2 changes: 0 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Server.init = function (channel, manager, config) {
Server.start = function (port) {
this.port = port;
this.acceptingConnections = true;
console.log('==== GOT START', port);
this.channel.emit('server:message', 'start');
};

Expand Down Expand Up @@ -78,7 +77,6 @@ Server.resume = function () {
Server.verifyRequest = function (request, connection) {
var self = this;
this.manager.emit('server:message', 'request', request, function (allow) {
console.log('RECEIVED RESPONSE', allow);
if (allow && self.acceptingConnections) {
self.accept(connection);
}
Expand Down
5 changes: 1 addition & 4 deletions lib/servers/TCPServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ TCPServer.init = function (channel, manager, config) {
TCPServer.start = function (port, host) {
// A port value of 0 will assign a random open port
var defaultPort = 0;
console.log('==== STARTING SERVER');
this.server.listen(this.port || defaultPort, host);
this._super(this.port || defaultPort);
};
Expand All @@ -41,7 +40,7 @@ TCPServer.start = function (port, host) {
* @param {bool} shutdown - force close (end) all connections without waiting for a response
*/
TCPServer.close = function (shutdown) {
this.server.close(this.onClose.bind(this));
this.server.close();

this._super(shutdown);
};
Expand All @@ -53,7 +52,6 @@ TCPServer.close = function (shutdown) {
* @param {Net.Socket} socket - instance of raw node TCP socket object
*/
TCPServer.accept = function (socket) {
console.log('ACCEPTING CONNECTION');
var tcpConn = new TCPConnection(this.processID, socket, this.manager);
this._super(tcpConn);
};
Expand All @@ -73,7 +71,6 @@ TCPServer.onConnection = function (socket) {
address: socket.remoteAddress,
port: socket.remotePort
};
console.log('GOT CONNECTION');
this.verifyRequest(request, socket);
};

Expand Down

0 comments on commit 76cb59e

Please sign in to comment.