]> git.meshlink.io Git - meshlink/commitdiff
Reset UTCP timers after a succesful key exchange.
authorGuus Sliepen <guus@meshlink.io>
Sun, 13 Aug 2017 15:51:28 +0000 (17:51 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sun, 13 Aug 2017 15:51:28 +0000 (17:51 +0200)
The problem is that MeshLink does key exchange with peers on-demand. One
has to start a channel for key exchange to be initiated, but it also tries
to send the first SYN packet immediately. This will not work, and then it
has to wait for the retransmit timer to expire before it will try to send
the SYN again. Since the retransmit timer is increased exponentially, this
can potentially take a long time. So when key exchange is finished, we now
force a reset of the timers of all UTCP connections with the peer.

src/net_packet.c
src/utcp

index e0b364311cf8d18d3e3e6cee91733e9d90c811c4..3eea0517e5a7a4287d93980576fb06758392eec1 100644 (file)
@@ -433,9 +433,11 @@ bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t
 
        if(type == SPTPS_HANDSHAKE) {
                if(!from->status.validkey) {
+                       logger(mesh, MESHLINK_INFO, "SPTPS key exchange with %s (%s) succesful", from->name, from->hostname);
                        from->status.validkey = true;
                        from->status.waitingforkey = false;
-                       logger(mesh, MESHLINK_INFO, "SPTPS key exchange with %s (%s) succesful", from->name, from->hostname);
+                       if(from->utcp)
+                               utcp_reset_timers(from->utcp);
                }
                return true;
        }
index b2e5de6b537188f77e1889853f6ba919bf35c77c..0f36bb393e49ecab387b1bfe88741a337d4a8834 160000 (submodule)
--- a/src/utcp
+++ b/src/utcp
@@ -1 +1 @@
-Subproject commit b2e5de6b537188f77e1889853f6ba919bf35c77c
+Subproject commit 0f36bb393e49ecab387b1bfe88741a337d4a8834