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.
- package/.npmignore +8 -0
- package/CHANGELOG.md +39 -1
- package/Makefile +3 -2
- package/README.md +1 -1
- package/bin/generate-defs.js +723 -0
- package/examples/tutorials/package.json +1 -1
- package/lib/channel.js +6 -0
- package/lib/defs.js +1 -1
- package/lib/mux.js +6 -21
- package/package-lock.json +711 -0
- package/package.json +3 -3
- package/test/channel_api.js +13 -0
- package/test/mux.js +34 -0
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(
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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;
|