Comparing version 0.6.0 to 0.6.1
@@ -137,3 +137,4 @@ // Open Source Initiative OSI - The MIT License (MIT):Licensing | ||
while(this._outBuffer.length() > 0 && this._outBuffer.hasCapacity()) { | ||
this._sendImmediately(this._outBuffer.remove()); | ||
this._socket.send(this._outBuffer.remove()); | ||
this._outBuffer.decrementCapacity(); | ||
} | ||
@@ -148,28 +149,2 @@ | ||
//Creates a header for an event | ||
Channel.prototype._createHeader = function() { | ||
return { v: PROTOCOL_VERSION, message_id: uuid.v4(), response_to: this.id }; | ||
}; | ||
//Immediately sends a messages | ||
Channel.prototype._sendImmediately = function(event) { | ||
//console.log("SEND", event); | ||
this._socket.send(event); | ||
this._outBuffer.decrementCapacity(); | ||
}; | ||
//Sends a _zpc_more event | ||
Channel.prototype._sendMore = function() { | ||
var capacity = this._inBuffer.getCapacity(); | ||
var event = events.create(this._envelope, this._createHeader(), "_zpc_more", [capacity]); | ||
this._sendImmediately(event); | ||
}; | ||
//Updates the capacity and sends a _zpc_more event | ||
Channel.prototype._resetCapacity = function() { | ||
var newCapacity = this._capacity - this._inBuffer.length(); | ||
this._inBuffer.setCapacity(newCapacity); | ||
this._sendMore(); | ||
}; | ||
//Sends a message | ||
@@ -190,3 +165,4 @@ //name : String | ||
if(this._outBuffer.hasCapacity()) { | ||
this._sendImmediately(event); | ||
this._socket.send(event); | ||
this._outBuffer.decrementCapacity(); | ||
} else { | ||
@@ -199,6 +175,19 @@ //console.log("QUEUE", event); | ||
this._fresh = false; | ||
this._sendMore(); | ||
this._resetCapacity(); | ||
} | ||
}; | ||
//Creates a header for an event | ||
Channel.prototype._createHeader = function() { | ||
return { v: PROTOCOL_VERSION, message_id: uuid.v4(), response_to: this.id }; | ||
}; | ||
//Updates the capacity and sends a _zpc_more event | ||
Channel.prototype._resetCapacity = function() { | ||
var newCapacity = this._capacity - this._inBuffer.length(); | ||
this._inBuffer.setCapacity(newCapacity); | ||
var event = events.create(this._envelope, this._createHeader(), "_zpc_more", [newCapacity]); | ||
this._socket.send(event); | ||
}; | ||
//Creates a new server-side channel | ||
@@ -205,0 +194,0 @@ //srcEvent : Object |
{ | ||
"name": "zerorpc", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"main": "./index.js", | ||
@@ -5,0 +5,0 @@ "author": "dotCloud <opensource@dotcloud.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46313
15
1091