]> git.meshlink.io Git - meshlink/blobdiff - src/sptps.c
Fix deleting configuration directories with hidden files.
[meshlink] / src / sptps.c
index ed1f67ff95afd11ac1adfd6f6b95edcca72bf7de..fab2e9d9b8a87a05dba12cb00e0cacc910d5a419 100644 (file)
@@ -374,10 +374,15 @@ static bool receive_sig(sptps_t *s, const char *data, uint16_t len) {
 
 // Force another Key EXchange (for testing purposes).
 bool sptps_force_kex(sptps_t *s) {
-       if(!s->outstate || s->state != SPTPS_SECONDARY_KEX) {
+       if(!s->outstate) {
                return error(s, EINVAL, "Cannot force KEX in current state");
        }
 
+       if(s->state != SPTPS_SECONDARY_KEX) {
+               // We are already in the middle of a key exchange
+               return true;
+       }
+
        s->state = SPTPS_KEX;
        return send_kex(s);
 }