ext/kgio/read.c in kgio-2.10.0 vs ext/kgio/read.c in kgio-2.11.0
- old
+ new
@@ -5,12 +5,17 @@
#include "nonblock.h"
static VALUE sym_wait_readable;
#ifdef USE_MSG_DONTWAIT
static const int peek_flags = MSG_DONTWAIT|MSG_PEEK;
+
+/* we don't need these variants, we call kgio_autopush_recv directly */
+static inline void kgio_autopush_read(VALUE io) { }
+
#else
static const int peek_flags = MSG_PEEK;
+static inline void kgio_autopush_read(VALUE io) { kgio_autopush_recv(io); }
#endif
struct rd_args {
VALUE io;
VALUE buf;
@@ -78,10 +83,11 @@
{
struct rd_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);
@@ -150,10 +156,11 @@
{
struct rd_args a;
long n;
prepare_read(&a, argc, argv, io);
+ kgio_autopush_recv(io);
if (a.len > 0) {
retry:
n = (long)recv(a.fd, a.ptr, a.len, MSG_DONTWAIT);
if (read_check(&a, n, "recv", io_wait) != 0)
@@ -203,9 +210,10 @@
{
struct rd_args a;
long n;
prepare_read(&a, argc, argv, io);
+ kgio_autopush_recv(io);
if (a.len > 0) {
if (peek_flags == MSG_PEEK)
set_nonblocking(a.fd);
retry: