diff options
author | Simon Rettberg | 2020-07-16 12:19:24 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-07-16 12:19:24 +0200 |
commit | 643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a (patch) | |
tree | a9a82d8752d991a021346bde0c3daf7ee9096ea6 /src/kernel | |
parent | [KERNEL] do_gettimeofday was removed in 5.0 (diff) | |
download | dnbd3-ng-643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a.tar.gz dnbd3-ng-643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a.tar.xz dnbd3-ng-643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a.zip |
[KERNEL] Assign socket timeouts directly, like other kernel modules
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/net.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/kernel/net.c b/src/kernel/net.c index b229164..7058b8b 100644 --- a/src/kernel/net.c +++ b/src/kernel/net.c @@ -608,7 +608,6 @@ static int __dnbd3_socket_connect(struct dnbd3_sock *sock, struct dnbd3_server *server) { int result = 0; - struct timeval timeout; if (server->host.port == 0 || server->host.type == 0) { error_sock(sock, "host or port not set"); @@ -619,8 +618,6 @@ static int __dnbd3_socket_connect(struct dnbd3_sock *sock, return -EIO; } - timeout.tv_sec = SOCKET_TIMEOUT_CLIENT_DATA; - timeout.tv_usec = 0; result = dnbd3_sock_create(server->host.type, SOCK_STREAM, IPPROTO_TCP, &sock->sock); if (result < 0) { @@ -628,10 +625,8 @@ static int __dnbd3_socket_connect(struct dnbd3_sock *sock, goto error; } - kernel_setsockopt(sock->sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, - sizeof(timeout)); - kernel_setsockopt(sock->sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, - sizeof(timeout)); + sock->sock->sk->sk_rcvtimeo = sock->sock->sk->sk_sndtimeo + = SOCKET_TIMEOUT_CLIENT_DATA * HZ; sock->sock->sk->sk_allocation = GFP_NOIO; if (server->host.type == HOST_IP4) { struct sockaddr_in sin; |