From 4c03735ef8a4d5eb2bdced759e2e87b146bde0f0 Mon Sep 17 00:00:00 2001 From: Aaron Date: Mon, 11 Jan 2010 22:04:39 -0800 Subject: [PATCH] Revert "SERVER-500 more port/socket corner cases" This reverts commit b691dc629e0696de36ba7b7607f4fd7c28a8e86b. --- shell/utils.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shell/utils.cpp b/shell/utils.cpp index e7db1ed7d2c..1fd3ef02a53 100644 --- a/shell/utils.cpp +++ b/shell/utils.cpp @@ -271,10 +271,13 @@ namespace mongo { cerr << "count for port: " << port_ << " is not 0 is: " << dbs.count( port_ ) << endl; assert( dbs.count( port_ ) == 0 ); } - if ( port_ <= 0 || portToSocket.find( port_ ) == portToSocket.end() || portToSocket[ port_ ] <= 0 ) { + if ( port_ > 0 ) { + if ( portToSocket.find( port_ ) == portToSocket.end() ) { oldSocket_ = -1; - } else { - oldSocket_ = portToSocket[ port_ ]; + } else { + oldSocket_ = portToSocket[ port_ ]; + assert( oldSocket_ > 0 ); + } } } @@ -284,11 +287,8 @@ namespace mongo { // port allocator left this socket open to prevent someone else from grabbing // the port -- now we need to close the socket - if ( oldSocket_ > 0 ) { + if ( oldSocket_ > 0 ) assert( 0 == close( oldSocket_ ) ); - portToSocket[ port_ ] = -1; - oldSocket_ = -1; - } fflush( 0 ); pid_ = fork();