Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allocate the frame writing buffer once, since it gets allocated to ma…

…x frame size anyway. (The parsing buffers vary in size)
  • Loading branch information...
commit fc2625bd5af0028944cb4d8650cd7101d18798ab 1 parent 1fc2f0a
@squaremo squaremo authored postwait committed
Showing with 2 additions and 1 deletion.
  1. +2 −1  amqp.js
View
3  amqp.js
@@ -778,6 +778,7 @@ function Connection (connectionArgs, options) {
this._defaultExchange = null;
this.channelCounter = 0;
+ this._sendBuffer = new Buffer(maxFrameBuffer);
self.addListener('connect', function () {
// channel 0 is the control channel.
@@ -992,7 +993,7 @@ Connection.prototype.heartbeat = function() {
Connection.prototype._sendMethod = function (channel, method, args) {
debug(channel + " < " + method.name + " " + JSON.stringify(args));
- var b = new Buffer(maxFrameBuffer);
+ var b = this._sendBuffer;
b.used = 0;
b[b.used++] = 1; // constants.frameMethod
Please sign in to comment.
Something went wrong with that request. Please try again.