From 9438c996470155444eac421a752ea6a919e8a202 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sat, 7 Jan 2017 11:52:26 +0100 Subject: [PATCH] client: adapt socket aborts to io_timeout --- kernel/mars_client.c | 10 ++++++++-- kernel/mars_net.c | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/mars_client.c b/kernel/mars_client.c index 77049c25..318d8c0f 100644 --- a/kernel/mars_client.c +++ b/kernel/mars_client.c @@ -446,9 +446,15 @@ void _do_timeout(struct client_output *output, struct list_head *anchor, bool fo if (!mars_net_is_alive) force = true; - if (!force && io_timeout <= 0) + if (!force && io_timeout <= 0) { + output->socket.s_send_abort = mars_client_abort; + output->socket.s_recv_abort = mars_client_abort; return; - + } + + output->socket.s_send_abort = 1; + output->socket.s_recv_abort = 1; + io_timeout *= HZ; traced_lock(&output->lock, flags); diff --git a/kernel/mars_net.c b/kernel/mars_net.c index 8a780713..afc91947 100644 --- a/kernel/mars_net.c +++ b/kernel/mars_net.c @@ -429,7 +429,7 @@ int _mars_send_raw(struct mars_socket *msock, const void *buf, int len) #endif if (status == -EAGAIN) { - if (msock->s_send_abort > 0 && ++msock->s_send_cnt > msock->s_send_abort) { + if (msock->s_send_abort > 0 && ++msock->s_send_cnt >= msock->s_send_abort) { MARS_WRN("#%d reached send abort %d\n", msock->s_debug_nr, msock->s_send_abort); status = -EINTR; break; @@ -623,7 +623,7 @@ int mars_recv_raw(struct mars_socket *msock, void *buf, int minlen, int maxlen) } if (status == -EAGAIN) { - if (msock->s_recv_abort > 0 && ++msock->s_recv_cnt > msock->s_recv_abort) { + if (msock->s_recv_abort > 0 && ++msock->s_recv_cnt >= msock->s_recv_abort) { MARS_WRN("#%d reached recv abort %d\n", msock->s_debug_nr, msock->s_recv_abort); status = -EINTR; goto err;