amqplib 0.5.5 → 0.5.6
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/CHANGELOG.md +8 -3
- package/bin/generate-defs.js +1 -1
- package/examples/tutorials/package.json +1 -1
- package/lib/defs.js +1 -1
- package/lib/mux.js +6 -21
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/test/mux.js +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Change log for amqplib
|
|
2
2
|
|
|
3
|
-
## Changes in v0.5.
|
|
3
|
+
## Changes in v0.5.5
|
|
4
4
|
|
|
5
|
-
git log v0.5.3..v0.5.
|
|
5
|
+
git log v0.5.3..v0.5.5
|
|
6
6
|
|
|
7
7
|
**NB** this includes a minor but possibly breaking change: after [PR
|
|
8
8
|
498](https://github.com/squaremo/amqp.node/pull/498), all confirmation
|
|
@@ -16,9 +16,14 @@ channel is closed.
|
|
|
16
16
|
498](https://github.com/squaremo/amqp.node/pull/498)); thanks
|
|
17
17
|
@johanneswuerbach
|
|
18
18
|
* Update supported NodeJS versions in package.json ([PR
|
|
19
|
-
525](https://github.com/squaremo/amqp.node/pull/525));
|
|
19
|
+
525](https://github.com/squaremo/amqp.node/pull/525)); thanks
|
|
20
20
|
@tingwai
|
|
21
21
|
|
|
22
|
+
## (Deprecated v0.5.4)
|
|
23
|
+
|
|
24
|
+
This release was mistakenly published without the generated file
|
|
25
|
+
`./defs.js`. It has been deprecated in favour of v0.5.5.
|
|
26
|
+
|
|
22
27
|
## Changes in v0.5.3
|
|
23
28
|
|
|
24
29
|
git log v0.5.2..v0.5.3
|
package/bin/generate-defs.js
CHANGED
|
@@ -124,7 +124,7 @@ println('var encodeTable = codec.encodeTable;');
|
|
|
124
124
|
println('var decodeFields = codec.decodeFields;');
|
|
125
125
|
nl();
|
|
126
126
|
|
|
127
|
-
println('var SCRATCH = Buffer.alloc(
|
|
127
|
+
println('var SCRATCH = Buffer.alloc(65536);');
|
|
128
128
|
println('var EMPTY_OBJECT = Object.freeze({});');
|
|
129
129
|
|
|
130
130
|
println('module.exports.constants = %s',
|
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;
|
package/package-lock.json
CHANGED
package/package.json
CHANGED
package/test/mux.js
CHANGED
|
@@ -51,6 +51,40 @@ test("single input", function(done) {
|
|
|
51
51
|
input.end();
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
test("single input, resuming stream", function(done) {
|
|
55
|
+
var input = stream();
|
|
56
|
+
var output = stream();
|
|
57
|
+
input.on('end', function() { output.end() });
|
|
58
|
+
|
|
59
|
+
var mux = new Mux(output);
|
|
60
|
+
mux.pipeFrom(input);
|
|
61
|
+
|
|
62
|
+
// Streams might be blocked and become readable again, simulate this
|
|
63
|
+
// using a special read function and a marker
|
|
64
|
+
var data = [1,2,3,4,'skip',6,7,8,9];
|
|
65
|
+
|
|
66
|
+
var oldRead = input.read;
|
|
67
|
+
input.read = function(size) {
|
|
68
|
+
var val = oldRead.call(input, size)
|
|
69
|
+
|
|
70
|
+
if (val === 'skip') {
|
|
71
|
+
input.emit('readable');
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return val;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
data.forEach(input.write.bind(input));
|
|
79
|
+
|
|
80
|
+
readAllObjects(output, function(vals) {
|
|
81
|
+
assert.deepEqual([1,2,3,4,6,7,8,9], vals);
|
|
82
|
+
done();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
input.end();
|
|
86
|
+
});
|
|
87
|
+
|
|
54
88
|
test("two sequential inputs", function(done) {
|
|
55
89
|
var input1 = stream();
|
|
56
90
|
var input2 = stream();
|