net: use TCP_USER_TIMEOUT

This commit is contained in:
Thomas Schoebel-Theuer 2020-09-08 18:52:21 +02:00 committed by Thomas Schoebel-Theuer
parent 2245893b80
commit 674564db72

View File

@ -202,6 +202,7 @@ void _set_socketopts(struct socket *sock, struct mars_tcp_params *params, bool i
.tv_sec = params->tcp_timeout,
};
#endif
unsigned int user_timeout = params->tcp_timeout * 1000;
int x_true = 1;
/* TODO: improve this by a table-driven approach
@ -229,6 +230,7 @@ void _set_socketopts(struct socket *sock, struct mars_tcp_params *params, bool i
_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, t);
_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, t);
#endif
_setsockopt(sock, IPPROTO_TCP, TCP_USER_TIMEOUT, user_timeout);
}
int mars_create_socket(struct mars_socket *msock,