Skip to content

Commit 0394c9d

Browse files
lgeigerrgbkrk
authored andcommitted
Sync with upstream (#31)
* Massive perf boost * 💥 fix travis tests: add pkg libssl-dev • also update gcc to 4.9 • update libzmq to 4.1.4 Signed-off-by: Bent Cardan <bent@nothingsatisfies.com> * Add unref/ref APIs to detach/attach sockets from/to the event loop. * This does not affect reference counting of internal Socket C++ objects which is a subclass of ObjectWrap because unref() only temporarily disables the socket polling without adding/removing endpoints. * To avoid conflicts with ObjectWrap's Unref/Ref methods, I used explicit method names in the C++ side (e.g., DetachFromEventLoop) while keeping the Javascript-side names same to vanilla Sockets (e.g., unref). * When there is no endpoints, it automatically detaches the socket from the event loop to reduce polling overheads. When there is one or more endpoints, it automatically re-attach the socket. * Update README for unref/ref APIs. * Also fix some Markdown incompatibilities with 3rd party editors. * Updated history * State cleanup when (un)bindsync fails Fixes #507 * History update * Update history * Skip curve export test if libsodium is missing (#509) * Fixes batch isClosed check (#513) * Bump NAN to 2.2.0 (#520) * Release notes update * Release 2.15.0 * Bump NAN to 2.3 This gets rid of deprecation warnings introduced in Node 6. * Release 2.15.1 * Travis test on Node.js 6 (#530) * Burst test for router/dealer (#529) * Burst test for router/dealer * Made burst-test multi-part * Should fix missing incoming messages (#531) * Should fix missing incoming messages * Final fix * Release * This fixes burst sends on "req" sockets. (#536) * This fixes burst sends on "req" sockets. * Fix missing read flush triggered during send * Release * skip monitoring callback if socket has been closed (#540)
1 parent 333c564 commit 0394c9d

20 files changed

+254
-81
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ node_modules
99
Makefile.gyp
1010
binding.Makefile
1111
binding.target.gyp.mk
12+
npm-debug.log
1213
gyp-mac-tool
1314
out/
1415
zmq

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ addons:
66
sources:
77
- ubuntu-toolchain-r-test
88
packages:
9-
- gcc-4.8
10-
- g++-4.8
9+
- gcc-4.9
10+
- g++-4.9
1111
- uuid-dev
12+
- libssl-dev
1213

1314
os:
1415
- linux
@@ -31,7 +32,7 @@ before_install:
3132
- nvm use $NODE_VERSION
3233
- node --version
3334
- npm --version
34-
- test "$(uname)" = "Darwin" || export CXX=g++-4.8 CC=gcc-4.8
35+
- test "$(uname)" = "Darwin" || export CXX=g++-4.9 CC=gcc-4.9
3536
- gcc --version
3637
- sh build_libzmq.sh
3738

History.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
2.15.3 / 2016-6-3
2+
=================
3+
4+
* 2.15.0 introduced a bug where request sockets could no longer batch up requests.
5+
This release should fix that [ronkorving, jaleigh]
6+
7+
2.15.2 / 2016-5-22
8+
==================
9+
10+
* 2.15.0 introduced a bug where some messages would not be received. This release
11+
should fix that [ronkorving]
12+
13+
2.15.1 / 2016-5-8
14+
=================
15+
16+
* Node.js 6 compatibility (NAN 2.3) [kkoopa]
17+
18+
2.15.0 / 2016-4-27
19+
==================
20+
21+
* Dropped support for Node 0.8 [reqshark]
22+
* Added unref/ref APIs to detach/attach sockets from/to the event loop [Joongi Kim]
23+
* Improved message throughput 3-fold on ZMQ 4 [ronkorving]
24+
* When bind or unbind failed, you could never try again (fixed) [ronkorving]
25+
* Various travis configuration improvements [reqshark]
26+
* Bumped NAN to 2.2.x [JanStevens]
27+
128
2.14.0 / 2015-11-20
229
===================
330

test/exports.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,23 @@ describe('exports', function(){
99
});
1010

1111
it('should generate valid curve keypair', function(done) {
12-
if (!semver.gte(zmq.version,'4.0.0') || require('os').platform() == 'win32'){
12+
try {
13+
var rep = zmq.socket('rep');
14+
rep.curve_server = 0;
15+
} catch(e) {
16+
console.log("libsodium seems to be missing (skipping curve test)");
1317
done();
14-
return console.warn('Test requires libzmq >= 4 compiled with libsodium');
18+
return;
1519
}
20+
1621
var curve = zmq.curveKeypair();
1722
should.exist(curve);
1823
should.exist(curve.public);
1924
should.exist(curve.secret);
2025
curve.public.length.should.equal(40);
2126
curve.secret.length.should.equal(40);
2227
done();
23-
});
28+
});
2429

2530
it('should export socket types and options', function(){
2631
// All versions.

test/socket.error-callback.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
var zmq = require('..')
3+
, should = require('should')
4+
, semver = require('semver');
5+
6+
var version = semver.gte(zmq.version, '3.2.0');
7+
8+
describe('socket.error-callback', function(){
9+
var sock;
10+
11+
if (!version) {
12+
return console.warn("ZMQ_ROUTER_MANDATORY requires libzmq 3.2.0, skipping test");
13+
}
14+
15+
it('should create a socket and set ZMQ_ROUTER_MANDATORY', function () {
16+
sock = zmq.socket('router');
17+
sock.setsockopt(zmq.ZMQ_ROUTER_MANDATORY, 1);
18+
});
19+
20+
it('should callback with error when not connected', function (done) {
21+
sock.send(['foo', 'bar'], null, function (error) {
22+
error.should.be.an.instanceof(Error);
23+
done();
24+
});
25+
});
26+
});

test/socket.events.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var zmq = require('..')
2-
, should = require('should')
3-
, semver = require('semver');
2+
, should = require('should');
43

54
describe('socket.events', function(){
65

@@ -14,18 +13,20 @@ describe('socket.events', function(){
1413
rep.send('world');
1514
});
1615

17-
rep.bind('inproc://stuff');
16+
rep.bind('inproc://stuffevents', function (error) {
17+
if (error) throw error;
18+
});
1819

1920
rep.on('bind', function(){
20-
req.connect('inproc://stuff');
21-
req.send('hello');
21+
req.connect('inproc://stuffevents');
2222
req.on('message', function(msg){
2323
msg.should.be.an.instanceof(Buffer);
2424
msg.toString().should.equal('world');
2525
req.close();
2626
rep.close();
2727
done();
2828
});
29+
req.send('hello');
2930
});
3031
});
3132
});

test/socket.messages.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ describe('socket.messages', function(){
3131
}
3232
});
3333

34-
pull.bind('inproc://stuff_ssm', function(){
34+
pull.bind('inproc://stuff_ssm', function (error) {
35+
if (error) throw error;
3536
push.connect('inproc://stuff_ssm');
3637
push.send('string');
3738
push.send(15.99);
@@ -49,7 +50,8 @@ describe('socket.messages', function(){
4950
done();
5051
});
5152

52-
pull.bind('inproc://stuff_ssmm', function(){
53+
pull.bind('inproc://stuff_ssmm', function (error) {
54+
if (error) throw error;
5355
push.connect('inproc://stuff_ssmm');
5456
push.send(['string', 15.99, new Buffer('buffer')]);
5557
});
@@ -67,7 +69,8 @@ describe('socket.messages', function(){
6769
done();
6870
});
6971

70-
pull.bind('inproc://stuff_sss', function(){
72+
pull.bind('inproc://stuff_sss', function (error) {
73+
if (error) throw error;
7174
push.connect('inproc://stuff_sss');
7275
push.send(['tobi', 'loki'], zmq.ZMQ_SNDMORE);
7376
push.send(['jane', 'luna'], zmq.ZMQ_SNDMORE);
@@ -104,7 +107,8 @@ describe('socket.messages', function(){
104107
pull.setsockopt(zmq.ZMQ_HWM, 1);
105108
}
106109

107-
push.bind('tcp://127.0.0.1:12345', function () {
110+
push.bind('tcp://127.0.0.1:12345', function (error) {
111+
if (error) throw error;
108112
push.send('string');
109113
push.send(15.99);
110114
push.send(new Buffer('buffer'));
@@ -129,7 +133,8 @@ describe('socket.messages', function(){
129133
}
130134
});
131135

132-
pull.bind('inproc://stuff_ssmm', function(){
136+
pull.bind('inproc://stuff_ssmm', function (error) {
137+
if (error) throw error;
133138
push.connect('inproc://stuff_ssmm');
134139

135140
push.send('hello', null, cb);

test/socket.monitor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ describe('socket.monitor', function() {
4141
// enable monitoring for this socket
4242
rep.monitor();
4343

44-
rep.bind('tcp://127.0.0.1:5423');
44+
rep.bind('tcp://127.0.0.1:5423', function (error) {
45+
if (error) throw error;
46+
});
4547

4648
rep.on('bind', function(){
4749
req.connect('tcp://127.0.0.1:5423');

test/socket.pair.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var zmq = require('..')
2-
, should = require('should')
3-
, semver = require('semver');
2+
, should = require('should');
43

54
describe('socket.pair', function(){
65

@@ -9,8 +8,9 @@ describe('socket.pair', function(){
98
, pairC = zmq.socket('pair');
109

1110
var n = 0;
12-
pairB.on('message', function (msg){
11+
pairB.on('message', function (msg) {
1312
msg.should.be.an.instanceof(Buffer);
13+
1414
switch (n++) {
1515
case 0:
1616
msg.toString().should.equal('foo');
@@ -27,14 +27,16 @@ describe('socket.pair', function(){
2727
}
2828
});
2929

30-
pairC.on('message', function (msg){
30+
pairC.on('message', function (msg) {
3131
msg.should.be.an.instanceof(Buffer);
3232
msg.toString().should.equal('barnacle');
3333
})
3434

35-
var addr = "inproc://stuff";
35+
var addr = "inproc://stuffpair";
36+
37+
pairB.bind(addr, function (error) {
38+
if (error) throw error;
3639

37-
pairB.bind(addr, function(){
3840
pairC.connect(addr);
3941
pairB.send('barnacle');
4042
pairC.send('foo');
@@ -43,4 +45,4 @@ describe('socket.pair', function(){
4345
});
4446
});
4547

46-
});
48+
});

test/socket.pub-sub.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ describe('socket.pub-sub', function(){
3434

3535
var addr = "inproc://stuff_ssps";
3636

37-
sub.bind(addr, function(){
37+
sub.bind(addr, function (error) {
38+
if (error) throw error;
3839
pub.connect(addr);
3940

4041
// The connect is asynchronous, and messages published to a non-
@@ -75,7 +76,8 @@ describe('socket.pub-sub', function(){
7576
}
7677
});
7778

78-
sub.bind('inproc://stuff_sspsf', function(){
79+
sub.bind('inproc://stuff_sspsf', function (error) {
80+
if (error) throw error;
7981
pub.connect('inproc://stuff_sspsf');
8082

8183
// See comments on pub-sub test.

0 commit comments

Comments
 (0)