aboutsummaryrefslogtreecommitdiff
path: root/src/sp/protocol/survey0/xrespond.c
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/survey0/xrespond.c
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/survey0/xrespond.c')
-rw-r--r--src/sp/protocol/survey0/xrespond.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/sp/protocol/survey0/xrespond.c b/src/sp/protocol/survey0/xrespond.c
index 81a40486..c4d54594 100644
--- a/src/sp/protocol/survey0/xrespond.c
+++ b/src/sp/protocol/survey0/xrespond.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
@@ -37,8 +37,8 @@ static void xresp0_pipe_fini(void *);
// resp0_sock is our per-socket protocol private structure.
struct xresp0_sock {
- nni_msgq * urq;
- nni_msgq * uwq;
+ nni_msgq *urq;
+ nni_msgq *uwq;
nni_atomic_int ttl;
nni_id_map pipes;
nni_aio aio_getq;
@@ -47,10 +47,10 @@ struct xresp0_sock {
// resp0_pipe is our per-pipe protocol private structure.
struct xresp0_pipe {
- nni_pipe * npipe;
+ nni_pipe *npipe;
xresp0_sock *psock;
uint32_t id;
- nni_msgq * sendq;
+ nni_msgq *sendq;
nni_aio aio_getq;
nni_aio aio_putq;
nni_aio aio_send;
@@ -150,6 +150,9 @@ xresp0_pipe_start(void *arg)
int rv;
if (nni_pipe_peer(p->npipe) != NNI_PROTO_SURVEYOR_V0) {
+ nng_log_warn("NNG-PEER-MISMATCH",
+ "Peer protocol mismatch: %d != %d, rejected.",
+ nni_pipe_peer(p->npipe), NNI_PROTO_SURVEYOR_V0);
return (NNG_EPROTO);
}
@@ -195,7 +198,7 @@ void
xresp0_sock_getq_cb(void *arg)
{
xresp0_sock *s = arg;
- nni_msg * msg;
+ nni_msg *msg;
uint32_t id;
xresp0_pipe *p;
@@ -262,8 +265,8 @@ xresp0_recv_cb(void *arg)
{
xresp0_pipe *p = arg;
xresp0_sock *s = p->psock;
- nni_msgq * urq = s->urq;
- nni_msg * msg;
+ nni_msgq *urq = s->urq;
+ nni_msg *msg;
int hops;
int ttl;