From 3f48dfcb372ccf940ae077bf220adf957a926c82 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 13 Aug 2017 17:51:28 +0200 Subject: [PATCH] Reset UTCP timers after a succesful key exchange. 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 | 4 +++- src/utcp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/net_packet.c b/src/net_packet.c index e0b36431..3eea0517 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -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; } diff --git a/src/utcp b/src/utcp index b2e5de6b..0f36bb39 160000 --- a/src/utcp +++ b/src/utcp @@ -1 +1 @@ -Subproject commit b2e5de6b537188f77e1889853f6ba919bf35c77c +Subproject commit 0f36bb393e49ecab387b1bfe88741a337d4a8834 -- 2.39.2