mirror of https://github.com/schoebel/mars
client: adapt socket aborts to io_timeout
This commit is contained in:
parent
c0da3f50fe
commit
9438c99647
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue