mirror of https://github.com/schoebel/mars
client: adapt socket aborts to io_timeout
This commit is contained in:
parent
a721d0daea
commit
165f40ef41
|
@ -443,9 +443,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;
|
||||
|
||||
mutex_lock(&output->mutex);
|
||||
|
|
|
@ -443,7 +443,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;
|
||||
|
@ -637,7 +637,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;
|
||||
|
|
Loading…
Reference in New Issue