amqplib 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "main": "send.js",
6
6
  "dependencies": {
7
7
  "amqplib": "../..",
8
- "node-uuid": "*"
8
+ "uuid": "*"
9
9
  },
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1"
package/lib/channel.js CHANGED
@@ -33,6 +33,12 @@ function Channel(connection) {
33
33
  this.on('nack', this.handleConfirm.bind(this, function(cb) {
34
34
  if (cb) cb(new Error('message nacked'));
35
35
  }));
36
+ this.on('close', function () {
37
+ var cb;
38
+ while (cb = this.unconfirmed.shift()) {
39
+ if (cb) cb(new Error('channel closed'));
40
+ }
41
+ })
36
42
  // message frame state machine
37
43
  this.handleMessage = acceptDeliveryOrReturn;
38
44
  }
package/lib/defs.js CHANGED
@@ -3077,7 +3077,7 @@ function decodeBasicProperties(buffer) {
3077
3077
  return fields;
3078
3078
  }
3079
3079
 
3080
- var Buffer = require("safe-buffer").Buffer, codec = require("./codec"), ints = require("buffer-more-ints"), encodeTable = codec.encodeTable, decodeFields = codec.decodeFields, SCRATCH = Buffer.alloc(16384), EMPTY_OBJECT = Object.freeze({});
3080
+ var Buffer = require("safe-buffer").Buffer, codec = require("./codec"), ints = require("buffer-more-ints"), encodeTable = codec.encodeTable, decodeFields = codec.decodeFields, SCRATCH = Buffer.alloc(65536), EMPTY_OBJECT = Object.freeze({});
3081
3081
 
3082
3082
  module.exports.constants = {
3083
3083
  FRAME_METHOD: 1,
package/lib/mux.js CHANGED
@@ -55,26 +55,11 @@ Mux.prototype._readIncoming = function() {
55
55
  // are empty, or we exhaust our ability to accept chunks.
56
56
  function roundrobin(streams) {
57
57
  var s;
58
- // if there's just one incoming stream we don't have to
59
- // go through all the dequeue/enqueueing
60
- if (streams.length === 1) {
61
- s = streams.shift();
62
- while (accepting) {
63
- var chunk = s.read();
64
- if (chunk !== null) {
65
- accepting = out.write(chunk);
66
- }
67
- else break;
68
- }
69
- if (!accepting) streams.push(s);
70
- }
71
- else {
72
- while (accepting && (s = streams.shift())) {
73
- var chunk = s.read();
74
- if (chunk !== null) {
75
- accepting = out.write(chunk);
76
- streams.push(s);
77
- }
58
+ while (accepting && (s = streams.shift())) {
59
+ var chunk = s.read();
60
+ if (chunk !== null) {
61
+ accepting = out.write(chunk);
62
+ streams.push(s);
78
63
  }
79
64
  }
80
65
  }
@@ -105,7 +90,7 @@ Mux.prototype._readIncoming = function() {
105
90
 
106
91
  Mux.prototype._scheduleRead = function() {
107
92
  var self = this;
108
-
93
+
109
94
  if (!self.scheduledRead) {
110
95
  schedule(function() {
111
96
  self.scheduledRead = false;