Commit 5fa2ac1d authored by Kenton Varda's avatar Kenton Varda

OSX will actually use a 1-byte socket buffer, apparently. Better use a bigger number...

parent 324b4d0f
...@@ -98,12 +98,20 @@ protected: ...@@ -98,12 +98,20 @@ protected:
// Note: OSX reports ENOTCONN if we also try to shutdown(fds[1], SHUT_RD). // Note: OSX reports ENOTCONN if we also try to shutdown(fds[1], SHUT_RD).
// Request that the buffer size be as small as possible, to force the event loop to kick in. // Request that the buffer size be as small as possible, to force the event loop to kick in.
// The kernel will round this up. We use 1 instead of 0 because OSX reports EINVAL for 0 and // FUN STUFF:
// Cygwin will apparently actually use a buffer size of 0 and therefore blocks forever waiting // - On Linux, the kernel rounds up to the smallest size it permits, so we can ask for a size of
// for buffer space. // zero.
uint one = 1; // - On OSX, the kernel reports EINVAL on zero, but will dutifully use a 1-byte buffer if we
KJ_SYSCALL(setsockopt(fds[0], SOL_SOCKET, SO_RCVBUF, &one, sizeof(one))); // set the size to 1. This tends to cause stack overflows due to ridiculously long promise
KJ_SYSCALL(setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, &one, sizeof(one))); // chains.
// - Cygwin will apparently actually use a buffer size of 0 and therefore block forever waiting
// for buffer space.
//
// Anyway, we now use 127 to avoid these issues (but also to screw around with non-word-boundary
// writes).
uint small = 127;
KJ_SYSCALL(setsockopt(fds[0], SOL_SOCKET, SO_RCVBUF, &small, sizeof(small)));
KJ_SYSCALL(setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, &small, sizeof(small)));
} }
~SerializeAsyncTest() { ~SerializeAsyncTest() {
close(fds[0]); close(fds[0]);
......
linux-gcc-4.7 1757 ./super-test.sh tmpdir capnp-gcc-4.7 quick linux-gcc-4.7 1748 ./super-test.sh tmpdir capnp-gcc-4.7 quick
linux-gcc-4.8 1760 ./super-test.sh tmpdir capnp-gcc-4.8 quick gcc-4.8 linux-gcc-4.8 1751 ./super-test.sh tmpdir capnp-gcc-4.8 quick gcc-4.8
linux-clang 1780 ./super-test.sh tmpdir capnp-clang quick clang linux-clang 1771 ./super-test.sh tmpdir capnp-clang quick clang
mac 805 ./super-test.sh remote beat caffeinate quick mac 800 ./super-test.sh remote beat caffeinate quick
cygwin 810 ./super-test.sh remote Kenton@flashman quick cygwin 805 ./super-test.sh remote Kenton@flashman quick
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment