Skip to content

Commit

Permalink
Accept messages up to max bson wire message size, NODE-184
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed May 13, 2014
1 parent 85137d3 commit 5d3585c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
7 changes: 7 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.4.4 2014-05-13
----------------
- Bumped BSON version to use the NaN 1.0 package, fixed strict comparison issue for ObjectID
- Removed leaking global variable (Issue #1174, https://github.com/dainis)
- MongoClient respects connectTimeoutMS for initial discovery process (NODE-185)
- Fix bug with return messages larger than 16MB but smaller than max BSON Message Size (NODE-184)

1.4.3 2014-05-01
----------------
- Clone options for commands to avoid polluting original options passed from Mongoose (Issue #1171, https://github.com/vkarpov15)
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx-docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# The short X.Y version.
version = '1.4'
# The full version, including alpha/beta/rc tags.
release = '1.4.3'
release = '1.4.4'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion lib/mongodb/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ var createDataHandler = exports.Connection.createDataHandler = function(self) {
// Retrieve the message size
var sizeOfMessage = binaryutils.decodeUInt32(data, 0);
// If we have a negative sizeOfMessage emit error and return
if(sizeOfMessage < 0 || sizeOfMessage > self.maxBsonSize) {
if(sizeOfMessage < 0 || sizeOfMessage > self.maxMessageSizeBytes) {
var errorObject = {err:"socketHandler", trace:'', bin:self.buffer, parseState:{
sizeOfMessage: sizeOfMessage,
bytesRead: self.bytesRead,
Expand Down
15 changes: 14 additions & 1 deletion lib/mongodb/mongo_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,19 @@ MongoClient.connect = function(url, options, callback) {
object.server_options.auto_reconnect = true;
}

// Establish the correct socketTimeout
var connectTimeoutMS = 30000;

// We have a server connection timeout setting
if(object.server_options && object.server_options.socketOptions && object.server_options.socketOptions.connectTimeoutMS) {
connectTimeoutMS = object.server_options.socketOptions.connectTimeoutMS;
}

// We have a rs options set for connection timeout, override any server ones
if(object.rs_options && object.rs_options.socketOptions && object.rs_options.socketOptions.connectTimeoutMS) {
connectTimeoutMS = object.rs_options.socketOptions.connectTimeoutMS;
}

// If we have more than a server, it could be replicaset or mongos list
// need to verify that it's one or the other and fail if it's a mix
// Connect to all servers and run ismaster
Expand All @@ -212,7 +225,7 @@ MongoClient.connect = function(url, options, callback) {
var _server_options = {
poolSize:1
, socketOptions: {
connectTimeoutMS:30000
connectTimeoutMS: connectTimeoutMS
, socketTimeoutMS: 30000
}
, auto_reconnect:false};
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "name" : "mongodb"
, "description" : "A node.js driver for MongoDB"
, "keywords" : ["mongodb", "mongo", "driver", "db"]
, "version" : "1.4.3"
, "version" : "1.4.4"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"
, "contributors" : [ "Aaron Heckmann",
"Christoph Pojer",
Expand Down Expand Up @@ -63,7 +63,7 @@
, "bugs" : { "mail" : "node-mongodb-native@googlegroups.com"
, "url" : "http://github.com/mongodb/node-mongodb-native/issues" }
, "dependencies" : {
"bson": "0.2.7"
"bson": "0.2.8"
}
, "devDependencies": {
"dox": "0.4.4"
Expand Down

0 comments on commit 5d3585c

Please sign in to comment.