diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-08-19 08:07:02 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-08-27 08:00:23 -0700 |
| commit | 83b7a9afec7b3659974c614cea69fa3abb904d24 (patch) | |
| tree | 7277bda8deb32c91614f236fb942a4c6cfbbe55b /src/core/platform.h | |
| parent | 1c3350f6f4a738815c39a67dc0ba1a953a1b9f03 (diff) | |
| download | nng-83b7a9afec7b3659974c614cea69fa3abb904d24.tar.gz nng-83b7a9afec7b3659974c614cea69fa3abb904d24.tar.bz2 nng-83b7a9afec7b3659974c614cea69fa3abb904d24.zip | |
fixes #608 Add TCP support to specify local network interface
This also fixes a leaked TCP connection on a failure path, which we
noticed while working this change.
Diffstat (limited to 'src/core/platform.h')
| -rw-r--r-- | src/core/platform.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/platform.h b/src/core/platform.h index 70f4e9ef..48f1e1a7 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -265,6 +265,15 @@ extern void nni_tcp_dialer_fini(nni_tcp_dialer *); // connection will be aborted. extern void nni_tcp_dialer_close(nni_tcp_dialer *); +// nni_tcp_dialer_set_src_addr sets the source address to use for outgoing +// connections. Only the IP (or IPv6) address may be specified; the port +// must be zero. This must be called before calling nni_tcp_dialer_dial. +// The source address must be associated with one of the addresses on the +// local system -- this is not checked until bind() is called just prior to +// the connect() call. Likewise the address family must be the same as the +// address used when dialing, or errors will occur. +extern int nni_tcp_dialer_set_src_addr(nni_tcp_dialer *, const nng_sockaddr *); + // nni_tcp_dialer_dial attempts to create an outgoing connection, // asynchronously, to the address specified. On success, the first (and only) // output will be an nni_tcp_conn * associated with the remote server. |
