diff --git a/deps/evcom/evcom.c b/deps/evcom/evcom.c index 4267d351e8..0849f8ad0f 100644 --- a/deps/evcom/evcom.c +++ b/deps/evcom/evcom.c @@ -1205,6 +1205,15 @@ evcom_stream_reset_timeout (evcom_stream *stream, float timeout) } } +void +evcom_stream_set_no_delay (evcom_stream *stream, int no_delay) +{ + if (DUPLEX(stream)) { + int flags = no_delay ? 1 : 0; + setsockopt(stream->recvfd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags)); + } +} + void evcom_stream_attach (EV_P_ evcom_stream *stream) { diff --git a/deps/evcom/evcom.h b/deps/evcom/evcom.h index 977941692a..644ec9737c 100644 --- a/deps/evcom/evcom.h +++ b/deps/evcom/evcom.h @@ -192,6 +192,7 @@ void evcom_stream_detach (evcom_stream *); void evcom_stream_read_resume (evcom_stream *); void evcom_stream_read_pause (evcom_stream *); void evcom_stream_reset_timeout (evcom_stream *, float timeout); +void evcom_stream_set_no_delay (evcom_stream *, int no_delay); void evcom_stream_write (evcom_stream *, const char *str, size_t len); /* Once the write buffer is drained, evcom_stream_close will shutdown the * writing end of the stream and will close the read end once the server diff --git a/doc/api.html b/doc/api.html index 8cf60291e3..6f33722f59 100644 --- a/doc/api.html +++ b/doc/api.html @@ -1712,6 +1712,16 @@ of 60 seconds (60000 ms).
If timeout is 0, then the idle timeout is disabled.
+Disables the Nagle algorithm. By default TCP connections use the Nagle +algorithm, they buffer data before sending it off. Setting noDelay will +immediately fire off data each time connection.send() is called. +
+Here is an example of which resolves "www.google.com" then reverse @@ -1922,7 +1932,7 @@ init (Handle<Object> target)