diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-04-14 15:43:59 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-04-14 18:52:56 -0700 |
| commit | 82b322a37bcf890275f91b56a9a0347be056be9d (patch) | |
| tree | 42a5f763f963c178b854e9326ef89f0d21582424 /src/sp/protocol/pubsub0 | |
| parent | 2b967f48a669f7199c40bc730f800e53d6d4fb72 (diff) | |
| download | nng-82b322a37bcf890275f91b56a9a0347be056be9d.tar.gz nng-82b322a37bcf890275f91b56a9a0347be056be9d.tar.bz2 nng-82b322a37bcf890275f91b56a9a0347be056be9d.zip | |
Log protocol connections rejected by protocol.
Diffstat (limited to 'src/sp/protocol/pubsub0')
| -rw-r--r-- | src/sp/protocol/pubsub0/pub.c | 5 | ||||
| -rw-r--r-- | src/sp/protocol/pubsub0/sub.c | 5 | ||||
| -rw-r--r-- | src/sp/protocol/pubsub0/xsub.c | 13 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/sp/protocol/pubsub0/pub.c b/src/sp/protocol/pubsub0/pub.c index b0a9ef07..9539b851 100644 --- a/src/sp/protocol/pubsub0/pub.c +++ b/src/sp/protocol/pubsub0/pub.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 @@ -135,6 +135,9 @@ pub0_pipe_start(void *arg) pub0_sock *sock = p->pub; if (nni_pipe_peer(p->pipe) != NNI_PROTO_SUB_V0) { + nng_log_warn("NNG-PEER-MISMATCH", + "Peer protocol mismatch: %d != %d, rejected.", + nni_pipe_peer(p->pipe), NNI_PROTO_SUB_V0); return (NNG_EPROTO); } nni_mtx_lock(&sock->mtx); diff --git a/src/sp/protocol/pubsub0/sub.c b/src/sp/protocol/pubsub0/sub.c index e7540dee..ee911153 100644 --- a/src/sp/protocol/pubsub0/sub.c +++ b/src/sp/protocol/pubsub0/sub.c @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // Copyright 2019 Nathan Kent <nate@nkent.net> // @@ -274,6 +274,9 @@ sub0_pipe_start(void *arg) if (nni_pipe_peer(p->pipe) != NNI_PROTO_PUB_V0) { // Peer protocol mismatch. + nng_log_warn("NNG-PEER-MISMATCH", + "Peer protocol mismatch: %d != %d, rejected.", + nni_pipe_peer(p->pipe), NNI_PROTO_PUB_V0); return (NNG_EPROTO); } diff --git a/src/sp/protocol/pubsub0/xsub.c b/src/sp/protocol/pubsub0/xsub.c index ad060087..abcdf8c9 100644 --- a/src/sp/protocol/pubsub0/xsub.c +++ b/src/sp/protocol/pubsub0/xsub.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 @@ -39,9 +39,9 @@ struct xsub0_sock { // sub0_pipe is our per-pipe protocol private structure. struct xsub0_pipe { - nni_pipe * pipe; + nni_pipe *pipe; xsub0_sock *sub; - nni_aio aio_recv; + nni_aio aio_recv; }; static void @@ -106,6 +106,9 @@ xsub0_pipe_start(void *arg) if (nni_pipe_peer(p->pipe) != NNI_PROTO_PUB_V0) { // Peer protocol mismatch. + nng_log_warn("NNG-PEER-MISMATCH", + "Peer protocol mismatch: %d != %d, rejected.", + nni_pipe_peer(p->pipe), NNI_PROTO_PUB_V0); return (NNG_EPROTO); } @@ -126,8 +129,8 @@ xsub0_recv_cb(void *arg) { xsub0_pipe *p = arg; xsub0_sock *s = p->sub; - nni_msgq * urq = s->urq; - nni_msg * msg; + nni_msgq *urq = s->urq; + nni_msg *msg; if (nni_aio_result(&p->aio_recv) != 0) { nni_pipe_close(p->pipe); |
