Skip to content

Commit

Permalink
Removed commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Mar 30, 2012
1 parent fc6eeba commit 01d73e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 39 deletions.
11 changes: 1 addition & 10 deletions lib/mongodb/connection/connection.js
Expand Up @@ -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);
Expand All @@ -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);
}
}

Expand All @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down
30 changes: 1 addition & 29 deletions lib/mongodb/connection/connection_pool.js
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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"));
}

Expand Down Expand Up @@ -221,9 +196,7 @@ ConnectionPool.prototype.stop = function(removeListeners) {
}

// Clean up
// this.connectionsWithErrors = [];
this.openConnections = [];
// this.connections = [];
}

// Check the status of the connection
Expand All @@ -239,7 +212,6 @@ ConnectionPool.prototype.checkoutConnection = function(id) {
}

ConnectionPool.prototype.getAllConnections = function() {
// return this.connections;
return this.openConnections;
}

Expand Down

0 comments on commit 01d73e3

Please sign in to comment.