aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/dialer.c5
-rw-r--r--src/core/listener.c5
-rw-r--r--src/sp/transport.h18
3 files changed, 20 insertions, 8 deletions
diff --git a/src/core/dialer.c b/src/core/dialer.c
index 388d9981..6224ce9b 100644
--- a/src/core/dialer.c
+++ b/src/core/dialer.c
@@ -541,9 +541,12 @@ nni_dialer_start(nni_dialer *d, unsigned flags)
void
nni_dialer_stop(nni_dialer *d)
{
+ d->d_ops.d_close(d->d_data);
nni_aio_stop(&d->d_tmo_aio);
nni_aio_stop(&d->d_con_aio);
- d->d_ops.d_close(d->d_data);
+ if (d->d_ops.d_stop) {
+ d->d_ops.d_stop(d->d_data);
+ }
}
nni_sock *
diff --git a/src/core/listener.c b/src/core/listener.c
index 3dc2a0fa..1eeaa3cd 100644
--- a/src/core/listener.c
+++ b/src/core/listener.c
@@ -524,9 +524,12 @@ nni_listener_start(nni_listener *l, int flags)
void
nni_listener_stop(nni_listener *l)
{
+ l->l_ops.l_close(l->l_data);
nni_aio_stop(&l->l_tmo_aio);
nni_aio_stop(&l->l_acc_aio);
- l->l_ops.l_close(l->l_data);
+ if (l->l_ops.l_stop) {
+ l->l_ops.l_stop(l->l_data);
+ }
}
nni_sock *
diff --git a/src/sp/transport.h b/src/sp/transport.h
index 10207f28..6d1e0d4a 100644
--- a/src/sp/transport.h
+++ b/src/sp/transport.h
@@ -43,11 +43,14 @@ struct nni_sp_dialer_ops {
// NNG_ECONNFAILED, NNG_ETIMEDOUT, and NNG_EPROTO.
void (*d_connect)(void *, nni_aio *);
- // d_close stops the dialer from operating altogether. It
- // does not affect pipes that have already been created. It is
- // nonblocking.
+ // d_close stops the dialer from operating altogether.
+ // It is nonblocking.
void (*d_close)(void *);
+ // d_stop is close, but also waits for the operation to be
+ // be fully stopped.
+ void (*d_stop)(void *);
+
// d_getopt is used to obtain an option.
int (*d_getopt)(void *, const char *, void *, size_t *, nni_type);
@@ -93,11 +96,14 @@ struct nni_sp_listener_ops {
// l_accept accepts an inbound connection.
void (*l_accept)(void *, nni_aio *);
- // l_close stops the listener from operating altogether. It
- // does not affect pipes that have already been created. It is
- // nonblocking.
+ // l_close stops the listener from operating altogether.
+ // It is nonblocking.
void (*l_close)(void *);
+ // l_stop is close, but also waits for the operation to be
+ // be fully stopped.
+ void (*l_stop)(void *);
+
// l_getopt is used to obtain an option.
int (*l_getopt)(void *, const char *, void *, size_t *, nni_type);