summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-06-13 14:28:43 -0400
committerDwight <dmerriman@gmail.com>2008-06-13 14:28:43 -0400
commit683671d4bbd039d88144d01061e9f37a58262cf4 (patch)
tree84e6670f96947fdc9c03bc2c5c0c6c9fdf9b18f1
parente0ac9757ac5c71187eea331f88d16e5bb1df2b90 (diff)
downloadmongo-683671d4bbd039d88144d01061e9f37a58262cf4.tar.gz
db msg end only works for localhost now for security.
-rw-r--r--db/db.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/db/db.cpp b/db/db.cpp
index aed40b39fd3..3beca0ba3a2 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -452,11 +452,16 @@ void connThread()
resp.setData(opReply, "i am fine");
dbMsgPort.reply(m, resp);
if( end ) {
- cout << curTimeMillis() % 10000 << " end msg" << endl;
- dbMsgPort.shutdown();
- sleepmillis(500);
- problem() << "exiting end msg" << endl;
- exit(EXIT_SUCCESS);
+ cout << curTimeMillis() % 10000 << " end msg " << dbMsgPort.farEnd.toString() << endl;
+ if( dbMsgPort.farEnd.isLocalHost() ) {
+ dbMsgPort.shutdown();
+ sleepmillis(500);
+ problem() << "exiting end msg" << endl;
+ exit(EXIT_SUCCESS);
+ }
+ else {
+ cout << " (not from localhost, ignoring end msg)" << endl;
+ }
}
}
else if( m.data->operation == dbQuery ) {
@@ -555,7 +560,8 @@ void msg(const char *m, const char *address, int port, int extras = 0) {
if( !p.connect(db) )
return;
- for( int q = 0; q < 3; q++ ) {
+ const int Loops = 1;
+ for( int q = 0; q < Loops; q++ ) {
Message send;
Message response;
@@ -570,11 +576,12 @@ void msg(const char *m, const char *address, int port, int extras = 0) {
double tm = t.micros() + 1;
cout << " ****ok. response.data:" << ok << " time:" << tm / 1000.0 << "ms " <<
((double) len) * 8 / 1000000 / (tm/1000000) << "Mbps" << endl;
- if( q+1 < 3 ) {
- cout << "\t\tSLEEP 8 then sending again" << endl;
+ if( q+1 < Loops ) {
+ cout << "\t\tSLEEP 8 then sending again as a test" << endl;
sleepsecs(8);
}
}
+ sleepsecs(1);
p.shutdown();
}