summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-07-15 15:50:12 -0700
committerAaron <aaron@10gen.com>2010-07-15 15:50:12 -0700
commit7e40a057c7521e0da00a81eacd5b561adb09c6d7 (patch)
tree3ed8e30cd02c3ebde01ea70cfd6ac566b48217cf /tools
parent2197e24460e8c73aaf0cf52de1b3f4027d3f9a6b (diff)
downloadmongo-7e40a057c7521e0da00a81eacd5b561adb09c6d7.tar.gz
SERVER-1387 add exhaust mode to mongo bridge
Diffstat (limited to 'tools')
-rw-r--r--tools/bridge.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/bridge.cpp b/tools/bridge.cpp
index 980b9d2c82c..b0e1530d0ac 100644
--- a/tools/bridge.cpp
+++ b/tools/bridge.cpp
@@ -19,6 +19,7 @@
#include "pch.h"
#include "../util/message.h"
#include "../client/dbclient.h"
+#include "../db/dbmessage.h"
using namespace mongo;
using namespace std;
@@ -46,9 +47,26 @@ public:
int oldId = m.header()->id;
if ( m.operation() == dbQuery || m.operation() == dbMsg || m.operation() == dbGetMore ) {
+ bool exhaust = false;
+ if ( m.operation() == dbQuery ) {
+ DbMessage d( m );
+ QueryMessage q( d );
+ exhaust = q.queryOptions & QueryOption_Exhaust;
+ }
Message response;
dest.port().call( m, response );
mp_.reply( m, response, oldId );
+ while ( exhaust ) {
+ MsgData *header = response.header();
+ QueryResult *qr = (QueryResult *) header;
+ if ( qr->cursorId ) {
+ response.reset();
+ dest.port().recv( response );
+ mp_.reply( m, response ); // m argument is ignored anyway
+ } else {
+ exhaust = false;
+ }
+ }
} else {
dest.port().say( m, oldId );
}