ext/libuv/src/unix/stream.c in libuv-2.0.1 vs ext/libuv/src/unix/stream.c in libuv-2.0.2
- old
+ new
@@ -807,19 +807,39 @@
}
do {
n = sendmsg(uv__stream_fd(stream), &msg, 0);
}
+#if defined(__APPLE__)
+ /*
+ * Due to a possible kernel bug at least in OS X 10.10 "Yosemite",
+ * EPROTOTYPE can be returned while trying to write to a socket that is
+ * shutting down. If we retry the write, we should get the expected EPIPE
+ * instead.
+ */
+ while (n == -1 && (errno == EINTR || errno == EPROTOTYPE));
+#else
while (n == -1 && errno == EINTR);
+#endif
} else {
do {
if (iovcnt == 1) {
n = write(uv__stream_fd(stream), iov[0].iov_base, iov[0].iov_len);
} else {
n = writev(uv__stream_fd(stream), iov, iovcnt);
}
}
+#if defined(__APPLE__)
+ /*
+ * Due to a possible kernel bug at least in OS X 10.10 "Yosemite",
+ * EPROTOTYPE can be returned while trying to write to a socket that is
+ * shutting down. If we retry the write, we should get the expected EPIPE
+ * instead.
+ */
+ while (n == -1 && (errno == EINTR || errno == EPROTOTYPE));
+#else
while (n == -1 && errno == EINTR);
+#endif
}
if (n < 0) {
if (errno != EAGAIN && errno != EWOULDBLOCK) {
/* Error */