diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-10-16 23:27:35 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2021-10-16 23:27:35 -0700 |
| commit | 9248ed7426e24443b42438797adcfa6d4714efe8 (patch) | |
| tree | f0b4659264c73272cfaae47247a2f58563ef34b4 /src/sp/transport/tls | |
| parent | 8d7dcb68d90524a316d2df99d4043a83ce72d6ea (diff) | |
| download | nng-9248ed7426e24443b42438797adcfa6d4714efe8.tar.gz nng-9248ed7426e24443b42438797adcfa6d4714efe8.tar.bz2 nng-9248ed7426e24443b42438797adcfa6d4714efe8.zip | |
fixes #1518 Disconnect during negotiation breaks listener
Diffstat (limited to 'src/sp/transport/tls')
| -rw-r--r-- | src/sp/transport/tls/tls.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index 75858839..4db9170d 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -258,8 +258,8 @@ tlstran_pipe_nego_cb(void *arg) nni_mtx_unlock(&ep->mtx); return; } - // We have both sent and received the headers. Lets check the - // receive side header. + // We have both sent and received the headers. Let's check the + // receiver. if ((p->rxlen[0] != 0) || (p->rxlen[1] != 'S') || (p->rxlen[2] != 'P') || (p->rxlen[3] != 0) || (p->rxlen[6] != 0) || (p->rxlen[7] != 0)) { @@ -269,7 +269,7 @@ tlstran_pipe_nego_cb(void *arg) NNI_GET16(&p->rxlen[4], p->peer); - // We are all ready now. We put this in the wait list, and + // We are ready now. We put this in the wait list, and // then try to run the matcher. nni_list_remove(&ep->negopipes, p); nni_list_append(&ep->waitpipes, p); @@ -280,6 +280,13 @@ tlstran_pipe_nego_cb(void *arg) return; error: + // If the connection is closed, we need to pass back a different + // error code. This is necessary to avoid a problem where the + // closed status is confused with the accept file descriptor + // being closed. + if (rv == NNG_ECLOSED) { + rv = NNG_ECONNSHUT; + } nng_stream_close(p->tls); if ((uaio = ep->useraio) != NULL) { |
