summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-04-26 12:14:14 -0400
committerEliot Horowitz <eliot@10gen.com>2010-04-26 12:14:14 -0400
commitef571d995ff9559118a3077a477cb92bdf5e8bfa (patch)
tree54d33614a775784672c644ae6be2611d2cf8dad4 /util
parentedeafad487838a012f4b794639bf389d0e2983a3 (diff)
downloadmongo-ef571d995ff9559118a3077a477cb92bdf5e8bfa.tar.gz
cleaning socket error logging and move demangleName to global location
Diffstat (limited to 'util')
-rw-r--r--util/assert_util.cpp23
-rw-r--r--util/assert_util.h2
-rw-r--r--util/message_server_port.cpp19
3 files changed, 40 insertions, 4 deletions
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 <cxxabi.h>
+#include <sys/file.h>
+#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<MessagingPort> 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;
}