Browse Source

Merge branch 'master' into net2

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
7881b59f6b
  1. 5
      Makefile
  2. 10
      deps/coupling/coupling.c
  3. 10
      src/node_net.cc
  4. 7
      test/pummel/test-tcp-pingpong.js

5
Makefile

@ -16,11 +16,14 @@ uninstall:
@$(WAF) uninstall @$(WAF) uninstall
test: all test: all
python tools/test.py --mode=release python tools/test.py --mode=release simple
test-all: all test-all: all
python tools/test.py --mode=debug,release python tools/test.py --mode=debug,release
test-release: all
python tools/test.py --mode=release
test-debug: all test-debug: all
python tools/test.py --mode=debug python tools/test.py --mode=debug

10
deps/coupling/coupling.c

@ -180,7 +180,7 @@ pull_pump (int pullfd, int pushfd)
/* eof */ /* eof */
close(pullfd); close(pullfd);
pullfd = -1; pullfd = -1;
} else if (r < 0 && errno != EINTR && errno != EAGAIN) { } else if (r < 0 && errno && errno != EINTR && errno != EAGAIN) {
/* error */ /* error */
perror("pull_pump read()"); perror("pull_pump read()");
close(pullfd); close(pullfd);
@ -192,7 +192,7 @@ pull_pump (int pullfd, int pushfd)
/* non-blocking write() to the pipe */ /* non-blocking write() to the pipe */
r = ring_buffer_push(&ring, pushfd); r = ring_buffer_push(&ring, pushfd);
if (r < 0 && errno != EAGAIN && errno != EINTR) { if (r < 0 && errno && errno != EAGAIN && errno != EINTR) {
if (errno == EPIPE) { if (errno == EPIPE) {
/* This happens if someone closes the other end of the pipe. This /* This happens if someone closes the other end of the pipe. This
* is a normal forced close of STDIN. Hopefully there wasn't data * is a normal forced close of STDIN. Hopefully there wasn't data
@ -274,7 +274,7 @@ push_pump (int pullfd, int pushfd)
/* eof */ /* eof */
close(pullfd); close(pullfd);
pullfd = -1; pullfd = -1;
} else if (r < 0 && errno != EINTR && errno != EAGAIN) { } else if (r < 0 && errno && errno != EINTR && errno != EAGAIN) {
perror("push_pump read()"); perror("push_pump read()");
close(pullfd); close(pullfd);
pullfd = -1; pullfd = -1;
@ -288,14 +288,14 @@ push_pump (int pullfd, int pushfd)
/* If there was a problem, just exit the entire function */ /* If there was a problem, just exit the entire function */
if (r < 0 && errno != EINTR) { if (r < 0 && errno && errno != EINTR && errno != EAGAIN) {
close(pushfd); close(pushfd);
close(pullfd); close(pullfd);
pushfd = pullfd = -1; pushfd = pullfd = -1;
return; return;
} }
} }
if (pullfd >= 0) { if (pullfd >= 0) {
/* select for readability on the pullfd */ /* select for readability on the pullfd */
r = select(pullfd+1, &readfds, NULL, &exceptfds, NULL); r = select(pullfd+1, &readfds, NULL, &exceptfds, NULL);

10
src/node_net.cc

@ -337,7 +337,7 @@ int Connection::AfterResolve(eio_req *req) {
if (address_list) freeaddrinfo(address_list); if (address_list) freeaddrinfo(address_list);
// no error. return. // no error. return.
if (req->result == 0) { if (req->result == 0 && !r) {
evcom_stream_attach(EV_DEFAULT_UC_ &connection->stream_); evcom_stream_attach(EV_DEFAULT_UC_ &connection->stream_);
goto out; goto out;
} }
@ -348,7 +348,13 @@ int Connection::AfterResolve(eio_req *req) {
* The fact that I'm modifying a read-only variable here should be * The fact that I'm modifying a read-only variable here should be
* good evidence of this. * good evidence of this.
*/ */
connection->stream_.errorno = req->result;
if (req->result) {
connection->stream_.errorno = req->result;
} else {
assert(r);
assert(connection->stream_.errorno);
}
connection->OnClose(); connection->OnClose();

7
test/pummel/test-tcp-pingpong.js

@ -82,8 +82,11 @@ function pingPongTest (port, host, on_complete) {
/* All are run at once, so run on different ports */ /* All are run at once, so run on different ports */
pingPongTest(PORT, "localhost"); pingPongTest(PORT, "localhost");
pingPongTest(PORT+1, null); pingPongTest(PORT+1, null);
pingPongTest(PORT+2, "::1");
// This IPv6 isn't working on Solaris
var solaris = /sunos/i.test(process.platform);
if (!solaris) pingPongTest(PORT+2, "::1");
process.addListener("exit", function () { process.addListener("exit", function () {
assert.equal(3, tests_run); assert.equal(solaris ? 2 : 3, tests_run);
}); });

Loading…
Cancel
Save