summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/db.cpp10
-rw-r--r--db/query.cpp3
-rw-r--r--db/query.h3
3 files changed, 11 insertions, 5 deletions
diff --git a/db/db.cpp b/db/db.cpp
index 1d417c093f3..a4133fb04ed 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -152,6 +152,7 @@ void receivedDelete(Message& m) {
}
void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& ss) {
+ MSGID responseTo = m.data->id;
DbMessage d(m);
const char *ns = d.getns();
setClient(ns);
@@ -166,7 +167,7 @@ void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& s
QueryResult* msgdata;
try {
- msgdata = runQuery(ns, ntoskip, ntoreturn, query, fields, ss);
+ msgdata = runQuery(m, ns, ntoskip, ntoreturn, query, fields, ss);
}
catch( AssertionException ) {
ss << " exception ";
@@ -196,7 +197,7 @@ void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& s
else {
cout << "ERROR: client is null; ns=" << ns << endl;
}
- dbMsgPort.reply(m, resp);
+ dbMsgPort.reply(m, resp, responseTo);
}
void receivedGetMore(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& ss) {
@@ -274,7 +275,7 @@ public:
};
void listen(int port) {
- const char *Version = "db version: 112 6jun2008";
+ const char *Version = "db version: 112.patch114 11jun2008";
problem() << Version << endl;
cout << Version << endl;
pdfileInit();
@@ -290,6 +291,9 @@ extern int callDepth;
class JniMessagingPort : public AbstractMessagingPort {
public:
JniMessagingPort(Message& _container) : container(_container) { }
+ void reply(Message& received, Message& response, MSGID) {
+ container = response;
+ }
void reply(Message& received, Message& response) {
container = response;
}
diff --git a/db/query.cpp b/db/query.cpp
index 2a624977630..1cd60df52b4 100644
--- a/db/query.cpp
+++ b/db/query.cpp
@@ -639,7 +639,7 @@ void killCursors(int n, long long *ids) {
auto_ptr<Cursor> findTableScan(const char *ns, JSObj& order);
-QueryResult* runQuery(const char *ns, int ntoskip, int _ntoreturn, JSObj jsobj,
+QueryResult* runQuery(Message& message, const char *ns, int ntoskip, int _ntoreturn, JSObj jsobj,
auto_ptr< set<string> > filter, stringstream& ss)
{
bool wantMore = true;
@@ -740,6 +740,7 @@ assert( debug.getN() < 5000 );
ClientCursor::add(cc);
cc->updateLocation();
cc->filter = filter;
+ cc->originalMessage = message;
}
}
break;
diff --git a/db/query.h b/db/query.h
index b0f7a503fcb..e8b9216b7b0 100644
--- a/db/query.h
+++ b/db/query.h
@@ -68,7 +68,7 @@ struct QueryResult : public MsgData {
QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid);
// caller must free() returned QueryResult.
-QueryResult* runQuery(const char *ns, int ntoskip, int ntoreturn,
+QueryResult* runQuery(Message&, const char *ns, int ntoskip, int ntoreturn,
JSObj j, auto_ptr< set<string> > fieldFilter,
stringstream&);
@@ -102,6 +102,7 @@ public:
int pos;
DiskLoc lastLoc;
auto_ptr< set<string> > filter;
+ Message originalMessage;
/* report to us that a new clientcursor exists so we can track it. You still
do the initial updateLocation() yourself.