[SECNET PATCH 04/12] site: Break out we_have_priority

Ian Jackson ijackson at chiark.greenend.org.uk
Wed May 15 23:13:29 BST 2019


No functional change.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 site.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/site.c b/site.c
index 2a62293..4a980d3 100644
--- a/site.c
+++ b/site.c
@@ -1741,6 +1741,10 @@ static bool_t named_for_us(struct site *st, const struct buffer_if *buf_in,
 	&& name_matches(&m->local,st->localname);
 }
 
+static bool_t we_have_priority(struct site *st, const struct msg *m) {
+    return st->our_name_later;
+}
+
 /* This function is called by the communication device to deliver
    packets from our peers.
    It should return True if the packet is recognised as being for
@@ -1782,7 +1786,7 @@ static bool_t site_incoming(void *sst, struct buffer_if *buf,
 	    /* We've just sent a message 1! They may have crossed on
 	       the wire. If we have priority then we ignore the
 	       incoming one, otherwise we process it as usual. */
-	    if (st->our_name_later) {
+	    if (we_have_priority(st,&named_msg)) {
 		BUF_FREE(buf);
 		slog(st,LOG_DUMP,"crossed msg1s; we are higher "
 		     "priority => ignore incoming msg1");
-- 
2.11.0




More information about the sgo-software-discuss mailing list