about summary refs log tree commit homepage
path: root/ext/kgio/accept.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-15 22:53:48 +0000
committerEric Wong <e@80x24.org>2016-12-15 23:51:08 +0000
commit333347c3ae54c8d605c673fcd11ff8dcb2ea4c38 (patch)
tree0663faa01cb9f84457a1b55ab52867ed986dd64c /ext/kgio/accept.c
parent64dc570f4b99f68b5ed792b36e7e8abc3df74927 (diff)
downloadkgio-333347c3ae54c8d605c673fcd11ff8dcb2ea4c38.tar.gz
The regression for existing users was unnacceptable and
completely poor judgement on my part.  This change brings
us back to potentially not-future-compatible code which
will impose maintenance burdens on us in the face of
future Ruby changes.

But TODAY, it is the most performant option for folks who
need to use autopush.

Revert "resurrect Kgio.autopush support in pure Ruby"
and "remove autopush support and make it a no-op"

This reverts commits 64dc570f4b99f68b5ed792b36e7e8abc3df74927
and 4347980fa66115425fa8b765353c8b1bfe5dec24.
Diffstat (limited to 'ext/kgio/accept.c')
-rw-r--r--ext/kgio/accept.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/kgio/accept.c b/ext/kgio/accept.c
index 4a45e2f..c847c92 100644
--- a/ext/kgio/accept.c
+++ b/ext/kgio/accept.c
@@ -160,6 +160,12 @@ static VALUE in_addr_set(VALUE io, struct sockaddr_storage *addr, socklen_t len)
         return rb_ivar_set(io, iv_kgio_addr, host);
 }
 
+#if defined(__linux__)
+#  define post_accept kgio_autopush_accept
+#else
+#  define post_accept(a,b) for(;0;)
+#endif
+
 static VALUE
 my_accept(struct accept_args *a, int force_nonblock)
 {
@@ -205,6 +211,7 @@ retry:
                 }
         }
         client_io = sock_for_fd(a->accepted_class, client_fd);
+        post_accept(a->accept_io, client_io);
 
         if (a->addr)
                 in_addr_set(client_io,