Note that you must have options ACCEPT_FILTER_DATA in your kernel
configuration or load the accf_data kernel module. The functionality is
not in the GENERIC kernel.
setsockopt(F->fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &backlog, sizeof(int));
}
#endif
+#ifdef SO_ACCEPTFILTER
+ if (defer_accept && !result)
+ {
+ struct accept_filter_arg afa;
+
+ memset(&afa, '\0', sizeof afa);
+ rb_strlcpy(afa.af_name, "dataready", sizeof afa.af_name);
+ (void)setsockopt(F->fd, SOL_SOCKET, SO_ACCEPTFILTER, &afa,
+ sizeof afa);
+ }
+#endif
return result;
}