0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

cleaning Listener and don't log ever http connect

This commit is contained in:
Eliot Horowitz 2010-04-07 09:34:14 -04:00
parent 2f668bd486
commit 8dbbef7267
3 changed files with 9 additions and 7 deletions

View File

@ -82,7 +82,7 @@ namespace mongo {
/* listener ------------------------------------------------------------------- */
void Listener::initAndListen() {
vector<SockAddr> mine = ipToAddrs(ip.c_str(), port);
vector<SockAddr> mine = ipToAddrs(_ip.c_str(), _port);
vector<int> socks;
int maxfd = 0; // needed for select()
@ -156,7 +156,7 @@ namespace mongo {
if ( s < 0 ) {
int x = errno; // so no global issues
if ( x == ECONNABORTED || x == EBADF ) {
log() << "Listener on port " << port << " aborted" << endl;
log() << "Listener on port " << _port << " aborted" << endl;
return;
} if ( x == 0 && inShutdown() ){
return; // socket closed
@ -166,7 +166,8 @@ namespace mongo {
}
if (from.getType() != AF_UNIX)
disableNagle(s);
if ( ! cmdLine.quiet ) log() << "connection accepted from " << from.toString() << " #" << ++connNumber << endl;
if ( _logConnect && ! cmdLine.quiet )
log() << "connection accepted from " << from.toString() << " #" << ++connNumber << endl;
accepted(s, from);
}
}

View File

@ -31,7 +31,7 @@ namespace mongo {
class Listener {
public:
Listener(const string &_ip, int p) : ip(_ip), port(p) { }
Listener(const string &ip, int p, bool logConnect=true ) : _ip(ip), _port(p), _logConnect(logConnect) { }
virtual ~Listener() {}
void initAndListen(); // never returns unless error (start a thread)
@ -42,8 +42,9 @@ namespace mongo {
}
private:
string ip;
int port;
string _ip;
int _port;
bool _logConnect;
};
class AbstractMessagingPort {

View File

@ -24,7 +24,7 @@
namespace mongo {
MiniWebServer::MiniWebServer(const string &ip, int port)
: Listener(ip, port)
: Listener(ip, port, false)
{}
string MiniWebServer::parseURL( const char * buf ) {