Handle only conn reset

This commit is contained in:
ruti 2024-03-08 04:48:35 +03:00
parent fc4e6b22bb
commit 0b4d6d72cc
2 changed files with 10 additions and 3 deletions

View File

@ -44,6 +44,8 @@ inline const int unie(int e)
return EHOSTUNREACH; return EHOSTUNREACH;
case WSAECONNREFUSED: case WSAECONNREFUSED:
return ECONNREFUSED; return ECONNREFUSED;
case WSAECONNRESET:
return ECONNRESET;
} }
#endif #endif
return e; return e;

11
proxy.c
View File

@ -472,7 +472,7 @@ static inline int on_tunnel(struct poolhd *pool, struct eval *val,
break; break;
if (n < 1) { if (n < 1) {
if (n) uniperror("recv"); if (n) uniperror("recv");
return -1; return get_e();
} }
val->recv_count += n; val->recv_count += n;
@ -565,12 +565,17 @@ int on_desync(struct poolhd *pool, struct eval *val,
int m; int m;
if (val->flag == FLAG_CONN) { if (val->flag == FLAG_CONN) {
if (on_tunnel(pool, val, buffer, bfsize, 0)) { int e = on_tunnel(pool, val, buffer, bfsize, 0);
return try_again(pool, val); if (e) {
if (unie(e) == ECONNRESET) {
return try_again(pool, val);
}
return -1;
} }
free(val->pair->buff.data); free(val->pair->buff.data);
val->pair->buff.data = 0; val->pair->buff.data = 0;
val->pair->buff.size = 0; val->pair->buff.size = 0;
val->type = EV_TUNNEL;
m = val->pair->try_count; m = val->pair->try_count;
return mode_add_get( return mode_add_get(