mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-31 07:04:11 +00:00
Dont save request if trigger is not set
This commit is contained in:
parent
6ce89b63aa
commit
ed7708c4e7
22
extend.c
22
extend.c
@ -220,7 +220,7 @@ int on_torst(struct poolhd *pool, struct eval *val)
|
|||||||
bool can_reconn = (
|
bool can_reconn = (
|
||||||
val->pair->buff.data && !val->recv_count
|
val->pair->buff.data && !val->recv_count
|
||||||
);
|
);
|
||||||
if (can_reconn || params.auto_level >= 1) {
|
if (can_reconn || params.auto_level > AUTO_NOSAVE) {
|
||||||
for (; m < params.dp_count; m++) {
|
for (; m < params.dp_count; m++) {
|
||||||
struct desync_params *dp = ¶ms.dp[m];
|
struct desync_params *dp = ¶ms.dp[m];
|
||||||
if (!dp->detect) {
|
if (!dp->detect) {
|
||||||
@ -260,7 +260,7 @@ int on_fin(struct poolhd *pool, struct eval *val)
|
|||||||
bool can_reconn = (
|
bool can_reconn = (
|
||||||
val->pair->buff.data && !val->recv_count
|
val->pair->buff.data && !val->recv_count
|
||||||
);
|
);
|
||||||
if (!can_reconn && params.auto_level < 1) {
|
if (!can_reconn && params.auto_level <= AUTO_NOSAVE) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
bool ssl_err = 0;
|
bool ssl_err = 0;
|
||||||
@ -338,7 +338,7 @@ static inline void free_first_req(struct eval *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ssize_t on_first_send(struct eval *client, char *buffer, ssize_t bfsize)
|
ssize_t on_first_send(struct eval *client, char *buffer, ssize_t n, ssize_t bfsize)
|
||||||
{
|
{
|
||||||
int m = client->attempt;
|
int m = client->attempt;
|
||||||
|
|
||||||
@ -354,8 +354,8 @@ ssize_t on_first_send(struct eval *client, char *buffer, ssize_t bfsize)
|
|||||||
if (m >= params.dp_count) {
|
if (m >= params.dp_count) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (params.auto_level > 0 && params.dp_count > 1) {
|
if (params.auto_level > AUTO_NOSAVE && params.dp_count > 1) {
|
||||||
client->mark = is_tls_chello(client->buff.data, client->buff.size);
|
client->mark = is_tls_chello(buffer, n);
|
||||||
}
|
}
|
||||||
client->attempt = m;
|
client->attempt = m;
|
||||||
|
|
||||||
@ -363,11 +363,13 @@ ssize_t on_first_send(struct eval *client, char *buffer, ssize_t bfsize)
|
|||||||
&& set_timeout(client->pair->fd, params.timeout)) {
|
&& set_timeout(client->pair->fd, params.timeout)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (client->buff.locked) {
|
||||||
assert(bfsize >= client->buff.size);
|
assert(bfsize >= client->buff.size);
|
||||||
memcpy(buffer, client->buff.data, client->buff.size);
|
memcpy(buffer, client->buff.data, client->buff.size);
|
||||||
|
|
||||||
return client->buff.size;
|
return client->buff.size;
|
||||||
}
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ssize_t tcp_send_hook(struct poolhd *pool, struct eval *remote,
|
ssize_t tcp_send_hook(struct poolhd *pool, struct eval *remote,
|
||||||
@ -387,7 +389,7 @@ ssize_t tcp_send_hook(struct poolhd *pool, struct eval *remote,
|
|||||||
int m = client->attempt;
|
int m = client->attempt;
|
||||||
|
|
||||||
if (client->recv_count == n) {
|
if (client->recv_count == n) {
|
||||||
n = on_first_send(client, buffer, bfsize);
|
n = on_first_send(client, buffer, n, bfsize);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -427,7 +429,9 @@ ssize_t tcp_recv_hook(struct poolhd *pool, struct eval *val,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val->flag != FLAG_CONN && val->pair->recv_count == 0)
|
if (val->flag != FLAG_CONN
|
||||||
|
&& params.auto_level > AUTO_NOBUFF
|
||||||
|
&& val->pair->recv_count == 0)
|
||||||
{
|
{
|
||||||
val->buff.size += n;
|
val->buff.size += n;
|
||||||
|
|
||||||
@ -452,7 +456,7 @@ ssize_t tcp_recv_hook(struct poolhd *pool, struct eval *val,
|
|||||||
}
|
}
|
||||||
free_first_req(val->pair);
|
free_first_req(val->pair);
|
||||||
}
|
}
|
||||||
if (params.timeout && params.auto_level < 1 &&
|
if (params.timeout && params.auto_level <= AUTO_NOSAVE &&
|
||||||
set_timeout(val->fd, 0)) {
|
set_timeout(val->fd, 0)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
6
main.c
6
main.c
@ -56,7 +56,7 @@ struct params params = {
|
|||||||
},
|
},
|
||||||
.repeats = 1,
|
.repeats = 1,
|
||||||
.debug = 0,
|
.debug = 0,
|
||||||
.auto_level = -1
|
.auto_level = AUTO_NOBUFF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -659,8 +659,8 @@ int main(int argc, char **argv)
|
|||||||
end = strchr(end, ',');
|
end = strchr(end, ',');
|
||||||
if (end) end++;
|
if (end) end++;
|
||||||
}
|
}
|
||||||
if (dp->detect && params.auto_level == -1) {
|
if (dp->detect && params.auto_level == AUTO_NOBUFF) {
|
||||||
params.auto_level = 0;
|
params.auto_level = AUTO_NOSAVE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user