Permalink
Browse files

CDRIVER-156 Cursor fails to terminate consistently or correctly at th…

…e end of a set of large documents

fixed - if cursor->reply->fields.num == 0 return MONGO_ERROR
complexity due to tailable cursors should be examined for simplification
  • Loading branch information...
1 parent 44a3c85 commit c3ca40723187dfa382891a34108c3d79b8234014 @gjmurakami-10gen gjmurakami-10gen committed Jul 11, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/mongo.c
View
12 src/mongo.c
@@ -1321,10 +1321,14 @@ MONGO_EXPORT int mongo_cursor_next( mongo_cursor *cursor ) {
if( mongo_cursor_get_more( cursor ) != MONGO_OK )
return MONGO_ERROR;
- /* If there's still a cursor id, then the message should be pending. */
- if( cursor->reply->fields.num == 0 && cursor->reply->fields.cursorID ) {
- cursor->err = MONGO_CURSOR_PENDING;
- return MONGO_ERROR;
+ if ( cursor->reply->fields.num == 0 ) {
+ /* Special case for tailable cursors. */
+ if ( cursor->reply->fields.cursorID ) {
+ cursor->err = MONGO_CURSOR_PENDING;
+ return MONGO_ERROR;
+ }
+ else
+ return MONGO_ERROR;
}
bson_init_finished_data( &cursor->current, &cursor->reply->objs );

0 comments on commit c3ca407

Please sign in to comment.