aboutsummaryrefslogtreecommitdiff
path: root/src/sp/protocol/pair0
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-04-14 15:43:59 -0700
committerGarrett D'Amore <garrett@damore.org>2024-04-14 18:52:56 -0700
commit82b322a37bcf890275f91b56a9a0347be056be9d (patch)
tree42a5f763f963c178b854e9326ef89f0d21582424 /src/sp/protocol/pair0
parent2b967f48a669f7199c40bc730f800e53d6d4fb72 (diff)
downloadnng-82b322a37bcf890275f91b56a9a0347be056be9d.tar.gz
nng-82b322a37bcf890275f91b56a9a0347be056be9d.tar.bz2
nng-82b322a37bcf890275f91b56a9a0347be056be9d.zip
Log protocol connections rejected by protocol.
Diffstat (limited to 'src/sp/protocol/pair0')
-rw-r--r--src/sp/protocol/pair0/pair.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/sp/protocol/pair0/pair.c b/src/sp/protocol/pair0/pair.c
index e272fd2e..558a9e3b 100644
--- a/src/sp/protocol/pair0/pair.c
+++ b/src/sp/protocol/pair0/pair.c
@@ -1,5 +1,5 @@
//
-// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include "core/nng_impl.h"
+#include "core/pipe.h"
#include "nng/protocol/pair0/pair.h"
// Pair protocol. The PAIR protocol is a simple 1:1 messaging pattern.
@@ -157,12 +158,18 @@ pair0_pipe_start(void *arg)
if (nni_pipe_peer(p->pipe) != NNI_PROTO_PAIR_V0) {
// Peer protocol mismatch.
+ nng_log_warn("NNG-PEER-MISMATCH",
+ "Peer protocol mismatch: %d != %d, rejected.",
+ nni_pipe_peer(p->pipe), NNI_PROTO_PAIR_V0);
return (NNG_EPROTO);
}
nni_mtx_lock(&s->mtx);
if (s->p != NULL) {
nni_mtx_unlock(&s->mtx);
+ nng_log_warn("NNG-PAIR-BUSY",
+ "Peer pipe protocol %d is already paired, rejected.",
+ nni_pipe_peer(p->pipe));
return (NNG_EBUSY); // Already have a peer, denied.
}
s->p = p;