summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-10-13 16:19:39 -0400
committerDwight <dmerriman@gmail.com>2008-10-13 16:19:39 -0400
commit1bef26dcc0f98e628a7c2f15b1b445c419810fe4 (patch)
tree0f8d7b8024e667ee9c5c06ffb7fc01f1b7617feb
parente7931c2ad603a2d1ce597b69cfb4f6d14c08276f (diff)
downloadmongo-r0.1.5_rc1.tar.gz
don't exit if client sends us garbage for a queryr0.1.5_rc1
-rw-r--r--db/db.cpp5
-rw-r--r--db/dbclient.h1
-rw-r--r--dbgrid/request.cpp11
3 files changed, 15 insertions, 2 deletions
diff --git a/db/db.cpp b/db/db.cpp
index dd81da54412..49ae829ed1e 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -207,7 +207,10 @@ void receivedQuery(DbResponse& dbresponse, /*AbstractMessagingPort& dbMsgPort, *
ss << " exception ";
problem() << " Caught Assertion in runQuery ns:" << ns << ' ' << e.toString() << '\n';
log() << " ntoskip:" << ntoskip << " ntoreturn:" << ntoreturn << '\n';
- log() << " query:" << query.toString() << endl;
+ if( query.valid() )
+ log() << " query:" << query.toString() << endl;
+ else
+ log() << " query object is not valid!" << endl;
JSObjBuilder err;
err.append("$err", e.msg.empty() ? "assertion during query" : e.msg);
diff --git a/db/dbclient.h b/db/dbclient.h
index d804b0ff65b..d437e065d30 100644
--- a/db/dbclient.h
+++ b/db/dbclient.h
@@ -106,6 +106,7 @@ class DBClientConnection : boost::noncopyable {
auto_ptr<SockAddr> server;
bool failed; // true if some sort of fatal error has ever happened
public:
+ MessagingPort& port() { return p; }
bool isFailed() const { return failed; }
DBClientConnection() : failed(false) { }
bool connect(const char *serverHostname, string& errmsg);
diff --git a/dbgrid/request.cpp b/dbgrid/request.cpp
index f5e40e18c28..1777cf05bab 100644
--- a/dbgrid/request.cpp
+++ b/dbgrid/request.cpp
@@ -27,7 +27,15 @@ void queryOp(Message& m, MessagingPort& p) {
cout << "TEMP: " << ns << endl;
- ScopedDbConnection c("localhost");
+ ScopedDbConnection dbcon("localhost");
+ DBClientConnection &c = dbcon.conn();
+
+ Message response;
+ bool ok = c.port().call(m, response);
+ uassert("dbgrid: error calling dbd", ok);
+//p.reply
+
+ dbcon.done();
}
void writeOp(int op, Message& m, MessagingPort& p) {
@@ -49,6 +57,7 @@ void writeOp(int op, Message& m, MessagingPort& p) {
void processRequest(Message& m, MessagingPort& p) {
int op = m.data->operation();
if( op == dbQuery ) {
+ queryOp(m,p);
}
else {
writeOp(op, m, p);