mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 00:14:07 +01:00
libratbox: Allow defer_accept on FreeBSD.
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.
This commit is contained in:
parent
521f9d63a9
commit
797a29f353
1 changed files with 11 additions and 0 deletions
|
@ -774,6 +774,17 @@ rb_listen(rb_fde_t *F, int backlog, int defer_accept)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue