roken: introduce rk_socket_set_keepalive

Change-Id: I3086a10cd3d23bef00336f5db7db3a35ca02d568
This commit is contained in:
Jeffrey Altman
2020-07-20 09:17:55 -04:00
committed by Jeffrey Altman
parent ee7e345af1
commit 51912c0215
3 changed files with 15 additions and 0 deletions

View File

@@ -305,6 +305,16 @@ socket_set_ipv6only (rk_socket_t sock, int val)
#endif
}
/*
* Set the that the `sock' keepalive setting.
*/
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
socket_set_keepalive(rk_socket_t sock, int val)
{
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof(val));
}
/**
* Create a file descriptor from a socket
*