From 6d0027fae75e4810d66eb4c5817255ffa517e158 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 5 Jan 2019 16:30:02 -0800 Subject: fixes #839 TCP listener_start API should use constant sockaddr --- include/nng/supplemental/tcp/tcp.h | 9 ++++----- include/nng/supplemental/tls/tls.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/nng/supplemental/tcp/tcp.h b/include/nng/supplemental/tcp/tcp.h index 447bc6f8..295006c7 100644 --- a/include/nng/supplemental/tcp/tcp.h +++ b/include/nng/supplemental/tcp/tcp.h @@ -125,11 +125,10 @@ NNG_DECL void nng_tcp_listener_free(nng_tcp_listener *); // the TCP port / address to be allocated. It does not accept any new // incoming connections. (The listenq depth is configured to some reasonable // default -- typically around 128.) This operation is synchronous. -// On success, the sockaddr will be update with the actual address bound. -// This is useful if the TCP port number 0 is specified, which permits -// the implementation to choose a free random port. The caller can then -// inspect the sockaddr to learn the actual bound port. -NNG_DECL int nng_tcp_listener_listen(nng_tcp_listener *, nng_sockaddr *); +// A zero valued port may be supplied in the sockaddr, in which case +// a follow up call to get the NNG_OPT_LOCADDR can be used to determine the +// bound address. +NNG_DECL int nng_tcp_listener_listen(nng_tcp_listener *, const nng_sockaddr *); // nng_tcp_listener_accept accepts an incoming connection (creating an // nng_tcp * object), and returns it in the nng_aio as the first output diff --git a/include/nng/supplemental/tls/tls.h b/include/nng/supplemental/tls/tls.h index ee80b45b..496f02e2 100644 --- a/include/nng/supplemental/tls/tls.h +++ b/include/nng/supplemental/tls/tls.h @@ -164,7 +164,7 @@ NNG_DECL int nng_tls_dialer_setopt( NNG_DECL int nng_tls_listener_alloc(nng_tls_listener **); NNG_DECL void nng_tls_listener_close(nng_tls_listener *); NNG_DECL void nng_tls_listener_free(nng_tls_listener *); -NNG_DECL int nng_tls_listener_listen(nng_tls_listener *, nng_sockaddr *); +NNG_DECL int nng_tls_listener_listen(nng_tls_listener *, const nng_sockaddr *); NNG_DECL void nng_tls_listener_accept(nng_tls_listener *, nng_aio *); NNG_DECL int nng_tls_listener_getopt( -- cgit v1.2.3-70-g09d2