Permalink
Browse files

Removed commented out code

  • Loading branch information...
christkv committed Mar 30, 2012
1 parent fc6eeba commit 01d73e3706382ed6c15ac48e960b81ebbc535c58
Showing with 2 additions and 39 deletions.
  1. +1 −10 lib/mongodb/connection/connection.js
  2. +1 −29 lib/mongodb/connection/connection_pool.js
@@ -81,10 +81,7 @@ Connection.prototype.start = function() {
// Start socket
this.connection.connect(this.socketOptions.port, this.socketOptions.host);
} else {
- // // Create a new stream
- // this.connection = new net.Stream();
- // // Create new connection instance
- // this.connection = new net.Socket();
+ // Create new connection instance
this.connection = net.createConnection(this.socketOptions.port, this.socketOptions.host);
// Set options on the socket
this.connection.setTimeout(this.socketOptions.timeout);
@@ -110,8 +107,6 @@ Connection.prototype.start = function() {
this.connection.on("timeout", timeoutHandler(this));
this.connection.on("drain", drainHandler(this));
this.connection.on("close", closeHandler(this));
- // // Start socket
- // this.connection.connect(this.socketOptions.port, this.socketOptions.host);
}
}
@@ -122,9 +117,6 @@ Connection.prototype.isConnected = function() {
// Write the data out to the socket
Connection.prototype.write = function(command, callback) {
- // console.log("=====================================================")
- // console.log("this.maxBsonSize = " + this.maxBsonSize)
-
try {
// If we have a list off commands to be executed on the same socket
if(Array.isArray(command)) {
@@ -391,7 +383,6 @@ var errorHandler = function(self) {
var closeHandler = function(self) {
return function(hadError) {
- // console.log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
// If we have an error during the connection phase
if(hadError && !self.connected) {
// Set disconnected
@@ -32,9 +32,7 @@ var ConnectionPool = exports.ConnectionPool = function(host, port, poolSize, bso
utils.setIntegerParameter(this.socketOptions, 'bufferSize', 0);
// Internal structures
- this.openConnections = [];
- // this.connections = [];
-
+ this.openConnections = [];
// Assign connection id's
this.connectionId = 0;
@@ -89,9 +87,6 @@ var _connect = function(_self) {
// Error handler
connection.on("error", function(err, connection) {
- // console.log("-------------------------------------------------------- error :: " + _self.openConnections.indexOf(this))
- // console.dir(this)
-
numberOfErrors++;
// If we are already disconnected ignore the event
if(connectionStatus != 'disconnected' && _self.listeners("error").length > 0) {
@@ -104,19 +99,10 @@ var _connect = function(_self) {
_self._poolState = 'disconnected';
// Stop
_self.stop();
-
- // // Clean up
- // _self.openConnections = [];
- // _self.connections = [];
});
// Close handler
connection.on("close", function() {
- // console.log("-------------------------------------------------------- close")
- // console.dir(this)
- // Only close when we have no more connections
- // if(_self.minPoolSize)
-
// If we are already disconnected ignore the event
if(connectionStatus !== 'disconnected' && _self.listeners("close").length > 0) {
_self.emit("close");
@@ -128,15 +114,10 @@ var _connect = function(_self) {
_self._poolState = 'disconnected';
// Stop
_self.stop();
- // // Clean up
- // _self.openConnections = [];
- // _self.connections = [];
});
// Timeout handler
connection.on("timeout", function(err, connection) {
- // console.log("-------------------------------------------------------- timeout")
- // console.dir(this)
// If we are already disconnected ignore the event
if(connectionStatus !== 'disconnected' && _self.listeners("timeout").length > 0) {
_self.emit("timeout", err);
@@ -148,18 +129,12 @@ var _connect = function(_self) {
_self._poolState = 'disconnected';
// Stop
_self.stop();
- // // Clean up
- // _self.openConnections = [];
- // _self.connections = [];
});
// Parse error, needs a complete shutdown of the pool
connection.on("parseError", function() {
- // console.log("-------------------------------------------------------- parseError")
- // console.dir(this)
// If we are already disconnected ignore the event
if(connectionStatus !== 'disconnected' && _self.listeners("parseError").length > 0) {
- // if(connectionStatus == 'connected') {
_self.emit("parseError", new Error("parseError occured"));
}
@@ -221,9 +196,7 @@ ConnectionPool.prototype.stop = function(removeListeners) {
}
// Clean up
- // this.connectionsWithErrors = [];
this.openConnections = [];
- // this.connections = [];
}
// Check the status of the connection
@@ -239,7 +212,6 @@ ConnectionPool.prototype.checkoutConnection = function(id) {
}
ConnectionPool.prototype.getAllConnections = function() {
- // return this.connections;
return this.openConnections;
}

0 comments on commit 01d73e3

Please sign in to comment.