mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-22 22:35:39 +00:00
--repeats for UDP
This commit is contained in:
parent
2240039377
commit
225ccc8319
23
extend.c
23
extend.c
@ -452,20 +452,23 @@ ssize_t tcp_recv_hook(struct poolhd *pool, struct eval *val,
|
|||||||
ssize_t udp_hook(struct eval *val,
|
ssize_t udp_hook(struct eval *val,
|
||||||
char *buffer, size_t bfsize, ssize_t n, struct sockaddr_ina *dst)
|
char *buffer, size_t bfsize, ssize_t n, struct sockaddr_ina *dst)
|
||||||
{
|
{
|
||||||
if (val->recv_count) {
|
if (val->round_count > params.repeats) {
|
||||||
return send(val->fd, buffer, n, 0);
|
return send(val->fd, buffer, n, 0);
|
||||||
}
|
}
|
||||||
int m = val->attempt;
|
int m = val->attempt;
|
||||||
if (!m) for (; m < params.dp_count; m++) {
|
if (!m) {
|
||||||
struct desync_params *dp = ¶ms.dp[m];
|
for (; m < params.dp_count; m++) {
|
||||||
if (!dp->detect &&
|
struct desync_params *dp = ¶ms.dp[m];
|
||||||
(!dp->proto || (dp->proto & IS_UDP)) &&
|
if (!dp->detect &&
|
||||||
(!dp->pf[0] || check_port(dp->pf, &dst->in6))) {
|
(!dp->proto || (dp->proto & IS_UDP)) &&
|
||||||
break;
|
(!dp->pf[0] || check_port(dp->pf, &dst->in6))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (m >= params.dp_count) {
|
||||||
if (m >= params.dp_count) {
|
return -1;
|
||||||
return -1;
|
}
|
||||||
|
val->attempt = m;
|
||||||
}
|
}
|
||||||
return desync_udp(val->fd, buffer, bfsize, n, &dst->sa, m);
|
return desync_udp(val->fd, buffer, bfsize, n, &dst->sa, m);
|
||||||
}
|
}
|
||||||
|
5
proxy.c
5
proxy.c
@ -746,6 +746,11 @@ int on_udp_tunnel(struct eval *val, char *buffer, size_t bfsize)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
val->recv_count += n;
|
val->recv_count += n;
|
||||||
|
if (val->round_sent == 0) {
|
||||||
|
val->round_count++;
|
||||||
|
val->round_sent += n;
|
||||||
|
val->pair->round_sent = 0;
|
||||||
|
}
|
||||||
ssize_t ns;
|
ssize_t ns;
|
||||||
|
|
||||||
if (val->flag == FLAG_CONN) {
|
if (val->flag == FLAG_CONN) {
|
||||||
|
Loading…
Reference in New Issue
Block a user