From: Guus Sliepen Date: Sun, 19 Apr 2020 14:28:43 +0000 (+0200) Subject: Make UTCP retranmissions trigger PMTU probes immediately. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=4f6c1be3863366ff439f773f0cd5eb9c3ec8cfab;p=meshlink Make UTCP retranmissions trigger PMTU probes immediately. If there are network problems while data is being transferred over a channel, we want to react to this as soon as possible. Set the retranmission callback to trigger the next PMTU probe immediately if there as none in progress. --- diff --git a/src/meshlink.c b/src/meshlink.c index b85795d4..72f484db 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -3549,6 +3549,17 @@ static void channel_accept(struct utcp_connection *utcp_connection, uint16_t por } } +static void channel_retransmit(struct utcp_connection *utcp_connection) { + node_t *n = utcp_connection->utcp->priv; + meshlink_handle_t *mesh = n->mesh; + + if(n->mtuprobes == 31) { + timeout_set(&mesh->loop, &n->mtutimeout, &(struct timespec) { + 0, 0 + }); + } +} + static ssize_t channel_send(struct utcp *utcp, const void *data, size_t len) { node_t *n = utcp->priv; @@ -3668,6 +3679,7 @@ void meshlink_set_channel_accept_cb(meshlink_handle_t *mesh, meshlink_channel_ac if(!n->utcp && n != mesh->self) { n->utcp = utcp_init(channel_accept, channel_pre_accept, channel_send, n); utcp_set_mtu(n->utcp, n->mtu - sizeof(meshlink_packethdr_t)); + utcp_set_retransmit_cb(n->utcp, channel_retransmit); } } @@ -3717,6 +3729,7 @@ meshlink_channel_t *meshlink_channel_open_ex(meshlink_handle_t *mesh, meshlink_n if(!n->utcp) { n->utcp = utcp_init(channel_accept, channel_pre_accept, channel_send, n); utcp_set_mtu(n->utcp, n->mtu - sizeof(meshlink_packethdr_t)); + utcp_set_retransmit_cb(n->utcp, channel_retransmit); mesh->receive_cb = channel_receive; if(!n->utcp) { @@ -4026,6 +4039,7 @@ void meshlink_set_node_channel_timeout(meshlink_handle_t *mesh, meshlink_node_t if(!n->utcp) { n->utcp = utcp_init(channel_accept, channel_pre_accept, channel_send, n); utcp_set_mtu(n->utcp, n->mtu - sizeof(meshlink_packethdr_t)); + utcp_set_retransmit_cb(n->utcp, channel_retransmit); } utcp_set_user_timeout(n->utcp, timeout); @@ -4037,6 +4051,7 @@ void update_node_status(meshlink_handle_t *mesh, node_t *n) { if(n->status.reachable && mesh->channel_accept_cb && !n->utcp) { n->utcp = utcp_init(channel_accept, channel_pre_accept, channel_send, n); utcp_set_mtu(n->utcp, n->mtu - sizeof(meshlink_packethdr_t)); + utcp_set_retransmit_cb(n->utcp, channel_retransmit); } if(mesh->node_status_cb) { diff --git a/src/utcp b/src/utcp index a6ea3a99..1d5bafdf 160000 --- a/src/utcp +++ b/src/utcp @@ -1 +1 @@ -Subproject commit a6ea3a99259b6f74c3151d0692d2899b3657b17d +Subproject commit 1d5bafdfb2ca9d357ee3099baf4cce5e92f89527