Skip to content

Commit

Permalink
Fixes for 0.4.X, updated history and package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Jan 4, 2012
1 parent ab8aa28 commit 2b989fd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
4 changes: 4 additions & 0 deletions HISTORY
@@ -1,3 +1,7 @@
0.9.7.3-5 2012-01-04
* Fix for RegExp serialization for 0.4.X where typeof /regexp/ == 'function' vs in 0.6.X typeof /regexp/ == 'object'
* Don't allow keepAlive and setNoDelay for 0.4.X as it throws errors

0.9.7.3-4 2012-01-04
* Chased down potential memory leak on findAndModify, Issue #467 (node.js removeAllListeners leaves the key in the _events object, node.js bug on eventlistener?, leads to extremely slow memory leak on listener object)
* Sanity checks for GridFS performance with benchmark added
Expand Down
12 changes: 10 additions & 2 deletions external-libs/bson/bson.cc
Expand Up @@ -368,7 +368,11 @@ uint32_t BSON::calculate_object_size2(Handle<Value> value) {
// Current object we are processing
Local<Object> currentObject = value->ToObject();
// Current list of object keys
Local<Array> keys = currentObject->GetOwnPropertyNames();
#if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6
Local<Array> keys = currentObject->GetPropertyNames();
#else
Local<Array> keys = currentObject->GetOwnPropertyNames();
#endif
// Contains pointer to keysIndex
uint32_t keysIndex = 0;
uint32_t keysLength = keys->Length();
Expand All @@ -380,7 +384,11 @@ uint32_t BSON::calculate_object_size2(Handle<Value> value) {
// If the index is bigger than the number of keys for the object
// we finished up the previous object and are ready for the next one
if(keysIndex >= keys->Length()) {
keys = currentObject->GetOwnPropertyNames();
#if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 6
keys = currentObject->GetPropertyNames();
#else
keys = currentObject->GetOwnPropertyNames();
#endif
keysLength = keys->Length();
}

Expand Down
32 changes: 19 additions & 13 deletions lib/mongodb/connection/connection.js
Expand Up @@ -49,16 +49,19 @@ Connection.prototype.start = function() {
// If we have a normal connection
if(this.socketOptions.ssl) {
// Create a new stream
this.connection = new net.Stream();
this.connection = new net.Stream();
// Set options on the socket
this.connection.setTimeout(this.socketOptions.timeout);
this.connection.setNoDelay(this.socketOptions.noDelay);
// Work around for 0.4.X
if(process.version.indexOf("v0.4") == -1) this.connection.setNoDelay(this.socketOptions.noDelay);
// Set keep alive if defined
if(this.socketOptions.keepAlive > 0) {
this.connection.setKeepAlive(true, this.socketOptions.keepAlive);
} else {
this.connection.setKeepAlive(false);
}
if(process.version.indexOf("v0.4") == -1) {
if(this.socketOptions.keepAlive > 0) {
this.connection.setKeepAlive(true, this.socketOptions.keepAlive);
} else {
this.connection.setKeepAlive(false);
}
}

// Set up pair for tls with server, accept self-signed certificates as well
this.pair = tls.createSecurePair(false);
Expand Down Expand Up @@ -88,13 +91,16 @@ Connection.prototype.start = function() {
this.connection = net.createConnection(this.socketOptions.port, this.socketOptions.host);
// Set options on the socket
this.connection.setTimeout(this.socketOptions.timeout);
this.connection.setNoDelay(this.socketOptions.noDelay);
// Work around for 0.4.X
if(process.version.indexOf("v0.4") == -1) this.connection.setNoDelay(this.socketOptions.noDelay);
// Set keep alive if defined
if(this.socketOptions.keepAlive > 0) {
this.connection.setKeepAlive(true, this.socketOptions.keepAlive);
} else {
this.connection.setKeepAlive(false);
}
if(process.version.indexOf("v0.4") == -1) {
if(this.socketOptions.keepAlive > 0) {
this.connection.setKeepAlive(true, this.socketOptions.keepAlive);
} else {
this.connection.setKeepAlive(false);
}
}

// Set up write stream
this.writeSteam = this.connection;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{ "name" : "mongodb"
, "description" : "A node.js driver for MongoDB"
, "keywords" : ["mongodb", "mongo", "driver", "db"]
, "version" : "0.9.7-3-4"
, "version" : "0.9.7-3-5"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"
, "contributors" : [ "Aaron Heckmann",
"Christoph Pojer",
Expand Down

0 comments on commit 2b989fd

Please sign in to comment.