From 0b4d6d72cce2a9c672ea14eaad7f07571aafea0e Mon Sep 17 00:00:00 2001 From: ruti <> Date: Fri, 8 Mar 2024 04:48:35 +0300 Subject: [PATCH] Handle only conn reset --- error.h | 2 ++ proxy.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/error.h b/error.h index 3c7ce1c..ecfb4b7 100644 --- a/error.h +++ b/error.h @@ -44,6 +44,8 @@ inline const int unie(int e) return EHOSTUNREACH; case WSAECONNREFUSED: return ECONNREFUSED; + case WSAECONNRESET: + return ECONNRESET; } #endif return e; diff --git a/proxy.c b/proxy.c index ebe9c7c..ec13eb9 100644 --- a/proxy.c +++ b/proxy.c @@ -472,7 +472,7 @@ static inline int on_tunnel(struct poolhd *pool, struct eval *val, break; if (n < 1) { if (n) uniperror("recv"); - return -1; + return get_e(); } val->recv_count += n; @@ -565,12 +565,17 @@ int on_desync(struct poolhd *pool, struct eval *val, int m; if (val->flag == FLAG_CONN) { - if (on_tunnel(pool, val, buffer, bfsize, 0)) { - return try_again(pool, val); + int e = on_tunnel(pool, val, buffer, bfsize, 0); + if (e) { + if (unie(e) == ECONNRESET) { + return try_again(pool, val); + } + return -1; } free(val->pair->buff.data); val->pair->buff.data = 0; val->pair->buff.size = 0; + val->type = EV_TUNNEL; m = val->pair->try_count; return mode_add_get(