chiark / gitweb /
site: Log about crossed MSG1 ignored only once
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 18 May 2019 00:28:02 +0000 (01:28 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 18 May 2019 01:16:36 +0000 (02:16 +0100)
If for some reason our peer isn't getting our MSG1s, they will
retransmit and we will ignore each retransmission.  Log this only
once.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

site.c

diff --git a/site.c b/site.c
index 681e595..11fc28b 100644 (file)
--- a/site.c
+++ b/site.c
@@ -336,6 +336,7 @@ struct site {
     uint32_t state;
     uint64_t now; /* Most recently seen time */
     bool_t allow_send_prod;
+    bool_t msg1_crossed_logged;
     int resolving_count;
     int resolving_n_results_all;
     int resolving_n_results_stored;
@@ -1525,6 +1526,7 @@ static bool_t enter_new_state(struct site *st, uint32_t next)
     case SITE_SENTMSG1:
        state_assert(st,st->state==SITE_RUN || st->state==SITE_RESOLVE);
        gen=generate_msg1;
+       st->msg1_crossed_logged = False;
        break;
     case SITE_SENTMSG2:
        state_assert(st,st->state==SITE_RUN || st->state==SITE_RESOLVE ||
@@ -1797,8 +1799,9 @@ static bool_t site_incoming(void *sst, struct buffer_if *buf,
               incoming one, otherwise we process it as usual. */
            if (st->setup_priority) {
                BUF_FREE(buf);
-               slog(st,LOG_DUMP,"crossed msg1s; we are higher "
-                    "priority => ignore incoming msg1");
+               if (!st->msg1_crossed_logged++)
+                   slog(st,LOG_DUMP,"crossed msg1s; we are higher "
+                        "priority => ignore incoming msg1");
                return True;
            } else {
                slog(st,LOG_DUMP,"crossed msg1s; we are lower "