Commit 6e478720 authored by Pekka Pessi's avatar Pekka Pessi

tport_type_udp.c: using SO_RCVBUFFORCE and SO_SNDBUFFORCE to set rmem/wmem on udp sockets

Referring reader to Linux sysctls to TPTAG_UDP_RMEM and TPTAG_UDP_WMEM
documentation.

darcs-hash:20080103121127-65a35-023a22e9b715deedfdb7dabb1213d41c4eedc647.gz
parent a28394a1
......@@ -311,6 +311,10 @@ tag_typedef_t tptag_debug_drop = UINTTAG_TYPEDEF(debug_drop);
*
* This is a parameter suitable for tuning.
*
* On Linux systems, the default value for receive buffer is set with
* the sysctl "net.core.rmem_default", and the maximum value is set with
* the sysctl "net.core.rmem_max".
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
......@@ -322,6 +326,10 @@ tag_typedef_t tptag_udp_rmem = UINTTAG_TYPEDEF(udp_rmem);
*
* This is a parameter suitable for tuning.
*
* On Linux systems, the default value for receive buffer is set with
* the sysctl "net.core.wmem_default", and the maximum value is set with
* the sysctl "net.core.wmem_max".
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
......
......@@ -150,12 +150,18 @@ int tport_udp_init_primary(tport_primary_t *pri,
TAG_END());
if (rmem != 0 &&
#if HAVE_SO_RCVBUFFORCE
setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, (void *)&rmem, sizeof rmem) < 0 &&
#endif
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void *)&rmem, sizeof rmem) < 0) {
SU_DEBUG_3(("setsockopt(SO_RCVBUF): %s\n",
su_strerror(su_errno())));
}
if (wmem != 0 &&
#if HAVE_SO_SNDBUFFORCE
setsockopt(s, SOL_SOCKET, SO_SNDBUFFORCE, (void *)&wmem, sizeof wmem) < 0 &&
#endif
setsockopt(s, SOL_SOCKET, SO_SNDBUF, (void *)&wmem, sizeof wmem) < 0) {
SU_DEBUG_3(("setsockopt(SO_SNDBUF): %s\n",
su_strerror(su_errno())));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment