diff --git a/dbtests/framework.cpp b/dbtests/framework.cpp index 8e536594b27..0f7636d070b 100644 --- a/dbtests/framework.cpp +++ b/dbtests/framework.cpp @@ -329,22 +329,6 @@ namespace mongo { assert(0); } - string demangleName( const type_info& typeinfo ){ -#ifdef _WIN32 - return typeinfo.name(); -#else - int status; - - char * niceName = abi::__cxa_demangle(typeinfo.name(), 0, 0, &status); - if ( ! niceName ) - return typeinfo.name(); - - string s = niceName; - free(niceName); - return s; -#endif - } - MyAssertionException * MyAsserts::getBase(){ MyAssertionException * e = new MyAssertionException(); e->ss << _file << ":" << _line << " " << _aexp << " != " << _bexp << " "; diff --git a/dbtests/framework.h b/dbtests/framework.h index 710b88092ce..9774832921b 100644 --- a/dbtests/framework.h +++ b/dbtests/framework.h @@ -45,8 +45,6 @@ namespace mongo { class Result; - string demangleName( const type_info& typeinfo ); - class TestCase { public: virtual ~TestCase(){} diff --git a/dbtests/perf/perftest.cpp b/dbtests/perf/perftest.cpp index 02b2fadd766..b385466d2e7 100644 --- a/dbtests/perf/perftest.cpp +++ b/dbtests/perf/perftest.cpp @@ -42,7 +42,7 @@ DBClientBase *client_; // (ie allocation) work for another test. template< class T > string testDb( T *t = 0 ) { - string name = mongo::regression::demangleName( typeid( T ) ); + string name = mongo::demangleName( typeid( T ) ); // Make filesystem safe. for( string::iterator i = name.begin(); i != name.end(); ++i ) if ( *i == ':' ) diff --git a/util/assert_util.cpp b/util/assert_util.cpp index 1a49d3bdb88..953b191b029 100644 --- a/util/assert_util.cpp +++ b/util/assert_util.cpp @@ -20,6 +20,11 @@ #include "assert.h" #include "file.h" +#ifndef _WIN32 +#include +#include +#endif + namespace mongo { AssertionCount assertionCount; @@ -214,5 +219,23 @@ namespace mongo { return ss.str(); } + + string demangleName( const type_info& typeinfo ){ +#ifdef _WIN32 + return typeinfo.name(); +#else + int status; + + char * niceName = abi::__cxa_demangle(typeinfo.name(), 0, 0, &status); + if ( ! niceName ) + return typeinfo.name(); + + string s = niceName; + free(niceName); + return s; +#endif + } + + } diff --git a/util/assert_util.h b/util/assert_util.h index 113fd620d84..b3152b6cdb6 100644 --- a/util/assert_util.h +++ b/util/assert_util.h @@ -209,6 +209,8 @@ namespace mongo { if( !myios.good() ) streamNotGood(msgid, msg, myios); } + string demangleName( const type_info& typeinfo ); + } // namespace mongo #define BOOST_CHECK_EXCEPTION MONGO_BOOST_CHECK_EXCEPTION diff --git a/util/message_server_port.cpp b/util/message_server_port.cpp index 2ea8287c2de..df364b19fa8 100644 --- a/util/message_server_port.cpp +++ b/util/message_server_port.cpp @@ -22,6 +22,8 @@ #include "message.h" #include "message_server.h" +#include "../db/cmdline.h" + namespace mongo { namespace pms { @@ -35,14 +37,19 @@ namespace mongo { assert( grab ); auto_ptr p( grab ); grab = 0; - + + string otherSide; + Message m; try { + otherSide = p->farEnd.toString(); + while ( 1 ){ m.reset(); if ( ! p->recv(m) ) { - log() << "end connection " << p->farEnd.toString() << endl; + if( !cmdLine.quiet ) + log() << "end connection " << otherSide << endl; p->shutdown(); break; } @@ -50,9 +57,13 @@ namespace mongo { handler->process( m , p.get() ); } } + catch ( const SocketException& se ){ + log() << "unclean socket shutdown from: " << otherSide << endl; + } catch ( const std::exception& e ){ - problem() << "uncaught exception (" << e.what() << ") in PortMessageServer::threadRun, closing connection" << endl; - }catch ( ... ){ + problem() << "uncaught exception (" << e.what() << ")(" << demangleName( typeid(e) ) <<") in PortMessageServer::threadRun, closing connection" << endl; + } + catch ( ... ){ problem() << "uncaught exception in PortMessageServer::threadRun, closing connection" << endl; }