0
0
mirror of https://github.com/hufrea/byedpi.git synced 2025-06-30 02:31:15 +00:00

-j after reconnect

This commit is contained in:
ruti 2025-05-20 20:12:09 +03:00
parent 31abd95aed
commit 13abef7c01

View File

@ -127,20 +127,25 @@ static int cache_add(const union sockaddr_u *dst, int m)
int connect_hook(struct poolhd *pool, struct eval *val,
const union sockaddr_u *dst, evcb_t next)
{
int m = cache_get(dst), init_m = m;
val->cache = (m == 0);
int m = val->attempt;
if (!m) {
m = cache_get(dst);
val->cache = (m == 0);
}
int init_m = m;
m = m < 0 ? 0 : m;
struct desync_params *dp;
for (; ; m++) {
if (m == params.dp_count) {
return -1;
}
dp = &params.dp[m];
if ((!dp->detect || m == init_m)
&& check_l34(dp, SOCK_STREAM, dst)) {
break;
}
if (m == params.dp_count) {
return -1;
}
}
val->attempt = m;
@ -173,15 +178,15 @@ static int reconnect(struct poolhd *pool, struct eval *val, int m)
assert(val->flag == FLAG_CONN);
struct eval *client = val->pair;
client->attempt = m;
if (create_conn(pool, client, &val->addr, &on_tunnel)) {
if (connect_hook(pool, client, &val->addr, &on_tunnel)) {
return -1;
}
val->pair = 0;
del_event(pool, val);
client->cb = &on_tunnel;
client->attempt = m;
client->cache = 1;
if (!client->buff) {