summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-06-09 15:05:00 -0400
committerDwight <dmerriman@gmail.com>2008-06-09 15:05:00 -0400
commit4690479e3494686003317b6d98f0a4b705794a14 (patch)
treef6a6a28a1821ea01e8f85077c149f8634f9029dc
parent5080d260b01f51dbf083245729763fedc9f5e8b8 (diff)
downloadmongo-4690479e3494686003317b6d98f0a4b705794a14.tar.gz
handle bad connect from something weird
-rw-r--r--db/db.cpp2
-rw-r--r--db/query.cpp1
-rw-r--r--grid/message.cpp13
-rw-r--r--grid/message.h1
4 files changed, 11 insertions, 6 deletions
diff --git a/db/db.cpp b/db/db.cpp
index 1b5eb5d5bc2..108e318e5d1 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -406,7 +406,7 @@ void connThread()
stringstream ss;
if( !dbMsgPort.recv(m) ) {
- cout << "MessagingPort::recv(): returned false" << endl;
+ cout << "MessagingPort::recv(): returned false " << dbMsgPort.farEnd.toString() << endl;
dbMsgPort.shutdown();
break;
}
diff --git a/db/query.cpp b/db/query.cpp
index bfef39534fd..0cb8dd83d5b 100644
--- a/db/query.cpp
+++ b/db/query.cpp
@@ -130,6 +130,7 @@ auto_ptr<Cursor> getIndexCursor(const char *ns, JSObj& query, JSObj& order) {
}
}
JSObj q2 = b2.done();
+ cout << "using index " << d->indexes[i].indexNamespace() << endl;
return auto_ptr<Cursor>(
new BtreeCursor(d->indexes[i].head, q2, 1, true));
}
diff --git a/grid/message.cpp b/grid/message.cpp
index caf2cd7e8a8..cfa9a02a912 100644
--- a/grid/message.cpp
+++ b/grid/message.cpp
@@ -121,16 +121,19 @@ bool MessagingPort::recv(Message& m) {
// assert( x == 4 );
- assert( len >= 0 && len <= 16000000 );
+ if( len < 0 || len > 16000000 ) {
+ cout << "bad recv() len: " << len << '\n';
+ return false;
+ }
int z = (len+1023)&0xfffffc00; assert(z>=len);
MsgData *md = (MsgData *) malloc(z);
md->len = len;
- if ( len <= 0 ){
- cout << "got a length of 0, something is wrong" << endl;
- return false;
- }
+ if ( len <= 0 ){
+ cout << "got a length of 0, something is wrong" << endl;
+ return false;
+ }
char *p = (char *) &md->id;
int left = len -4;
diff --git a/grid/message.h b/grid/message.h
index 604e9a67343..be2749c8bea 100644
--- a/grid/message.h
+++ b/grid/message.h
@@ -45,6 +45,7 @@ public:
private:
int sock;
+public:
SockAddr farEnd;
};