14
mud.c
14
mud.c
@@ -568,7 +568,7 @@ mud_reset_path(struct mud_path *path)
|
|||||||
{
|
{
|
||||||
path->window = 0;
|
path->window = 0;
|
||||||
path->ok = 0;
|
path->ok = 0;
|
||||||
path->msg_sent = 0;
|
path->msg.sent = 0;
|
||||||
path->loss_count = 0;
|
path->loss_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1146,8 +1146,8 @@ mud_send_msg(struct mud *mud, struct mud_path *path, uint64_t now,
|
|||||||
msg->loss = (unsigned char)path->tx.loss;
|
msg->loss = (unsigned char)path->tx.loss;
|
||||||
|
|
||||||
if (!mud->peer.set || !sent_time) {
|
if (!mud->peer.set || !sent_time) {
|
||||||
if (path->msg_sent < MUD_MSG_SENT_MAX)
|
if (path->msg.sent < MUD_MSG_SENT_MAX)
|
||||||
path->msg_sent++;
|
path->msg.sent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct mud_crypto_opt opt = {
|
const struct mud_crypto_opt opt = {
|
||||||
@@ -1316,7 +1316,7 @@ mud_recv_msg(struct mud *mud, struct mud_path *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
path->rx.loss = (uint64_t)msg->loss;
|
path->rx.loss = (uint64_t)msg->loss;
|
||||||
path->msg_sent = 0;
|
path->msg.sent = 0;
|
||||||
path->ok = 1;
|
path->ok = 1;
|
||||||
|
|
||||||
if (!mud->peer.set)
|
if (!mud->peer.set)
|
||||||
@@ -1445,7 +1445,7 @@ mud_update(struct mud *mud)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mud->peer.set) {
|
if (mud->peer.set) {
|
||||||
if (path->msg_sent >= MUD_MSG_SENT_MAX) {
|
if (path->msg.sent >= MUD_MSG_SENT_MAX) {
|
||||||
if (path->mtu.probe == MUD_MTU_MIN) {
|
if (path->mtu.probe == MUD_MTU_MIN) {
|
||||||
mud_reset_path(path);
|
mud_reset_path(path);
|
||||||
} else {
|
} else {
|
||||||
@@ -1454,14 +1454,14 @@ mud_update(struct mud *mud)
|
|||||||
path->mtu.ok = MUD_MTU_MIN;
|
path->mtu.ok = MUD_MTU_MIN;
|
||||||
mud_reset_path(path);
|
mud_reset_path(path);
|
||||||
} else {
|
} else {
|
||||||
path->msg_sent = 0;
|
path->msg.sent = 0;
|
||||||
}
|
}
|
||||||
path->mtu.max = path->mtu.probe - 1;
|
path->mtu.max = path->mtu.probe - 1;
|
||||||
path->mtu.probe = (path->mtu.min + path->mtu.max) >> 1;
|
path->mtu.probe = (path->mtu.min + path->mtu.max) >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((path->msg_sent >= MUD_MSG_SENT_MAX) ||
|
if ((path->msg.sent >= MUD_MSG_SENT_MAX) ||
|
||||||
(path->rx.time &&
|
(path->rx.time &&
|
||||||
mud->last_recv_time > path->rx.time + MUD_ONE_SEC)) {
|
mud->last_recv_time > path->rx.time + MUD_ONE_SEC)) {
|
||||||
mud_remove_path(path);
|
mud_remove_path(path);
|
||||||
|
|||||||
2
mud.h
2
mud.h
@@ -44,6 +44,7 @@ struct mud_path {
|
|||||||
struct {
|
struct {
|
||||||
uint64_t time;
|
uint64_t time;
|
||||||
uint64_t timeout;
|
uint64_t timeout;
|
||||||
|
uint64_t sent;
|
||||||
uint64_t set;
|
uint64_t set;
|
||||||
} msg;
|
} msg;
|
||||||
struct {
|
struct {
|
||||||
@@ -56,7 +57,6 @@ struct mud_path {
|
|||||||
uint64_t window_time;
|
uint64_t window_time;
|
||||||
struct mud_pubkey pk;
|
struct mud_pubkey pk;
|
||||||
unsigned char ok;
|
unsigned char ok;
|
||||||
unsigned msg_sent;
|
|
||||||
int loss_count;
|
int loss_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user