ext/kgio/read_write.c in kgio-2.7.2 vs ext/kgio/read_write.c in kgio-2.7.3

- old
+ new

@@ -11,12 +11,22 @@ * notice. */ #if defined(__linux__) && ! defined(USE_MSG_DONTWAIT) # define USE_MSG_DONTWAIT static const int peek_flags = MSG_DONTWAIT|MSG_PEEK; + +/* we don't need these variants, we call kgio_autopush_send/recv directly */ +static inline void kgio_autopush_read(VALUE io) { } +static inline void kgio_autopush_write(VALUE io) { } + #else static const int peek_flags = MSG_PEEK; +# include <netinet/tcp.h> +# if defined(TCP_NOPUSH) +static inline void kgio_autopush_read(VALUE io) { kgio_autopush_recv(io); } +static inline void kgio_autopush_write(VALUE io) { kgio_autopush_send(io); } +# endif #endif NORETURN(static void raise_empty_bt(VALUE, const char *)); NORETURN(static void my_eof_error(void)); NORETURN(static void wr_sys_fail(const char *)); @@ -110,10 +120,11 @@ { struct io_args a; long n; prepare_read(&a, argc, argv, io); + kgio_autopush_read(io); if (a.len > 0) { set_nonblocking(a.fd); retry: n = (long)read(a.fd, a.ptr, a.len); @@ -355,9 +366,11 @@ set_nonblocking(a.fd); retry: n = (long)write(a.fd, a.ptr, a.len); if (write_check(&a, n, "write", io_wait) != 0) goto retry; + if (TYPE(a.buf) != T_SYMBOL) + kgio_autopush_write(io); return a.buf; } /* * call-seq: