diff options
author | 2017-12-13 08:23:14 -0800 | |
---|---|---|
committer | 2017-12-13 08:23:14 -0800 | |
commit | dcb9493e265940fe4dd6947d7a623a977029e2ad (patch) | |
tree | 8daaa101688eeb0c0b111eeea9ef7023714bd658 /src/core/lib/iomgr/tcp_client_posix.h | |
parent | 4792769d10ccaea80e70fbe9be704de807e7c336 (diff) | |
parent | bdf63919b8e7e5fde7ce63b9bf2acbd85cc712e2 (diff) |
Merge pull request #13450 from daniel-j-born/tcp_client
Refactor POSIX TCP client connect.
Diffstat (limited to 'src/core/lib/iomgr/tcp_client_posix.h')
-rw-r--r-- | src/core/lib/iomgr/tcp_client_posix.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/tcp_client_posix.h b/src/core/lib/iomgr/tcp_client_posix.h index 7d0f133a6b..57e50a67d2 100644 --- a/src/core/lib/iomgr/tcp_client_posix.h +++ b/src/core/lib/iomgr/tcp_client_posix.h @@ -23,7 +23,44 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/tcp_client.h" +/* Create an endpoint from a connected grpc_fd. + + fd: a connected FD. Ownership is taken. + channel_args: may contain custom settings for the endpoint + addr_str: destination address in printable format + Returns: a new endpoint +*/ grpc_endpoint* grpc_tcp_client_create_from_fd( grpc_fd* fd, const grpc_channel_args* channel_args, const char* addr_str); +/* Return a configured, unbound, unconnected TCP client grpc_fd. + + channel_args: may contain custom settings for the fd + addr: the destination address + mapped_addr: out parameter. addr mapped to an address appropriate to the + type of socket FD created. For example, if addr is IPv4 and dual stack + sockets are available, mapped_addr will be an IPv4-mapped IPv6 address + fdobj: out parameter. The new FD + Returns: error, if any. Out parameters are not set on error +*/ +grpc_error* grpc_tcp_client_prepare_fd(const grpc_channel_args* channel_args, + const grpc_resolved_address* addr, + grpc_resolved_address* mapped_addr, + grpc_fd** fdobj); + +/* Connect a configured TCP client grpc_fd. + + interested_parties: a set of pollsets that would be interested in this + connection being established (in order to continue their work + closure: called when complete. On success, *ep will be set. + fdobj: an FD returned from grpc_tcp_client_prepare_fd(). Ownership is taken + channel_args: may contain custom settings for the endpoint + deadline: connection deadline + ep: out parameter. Set before closure is called if successful +*/ +void grpc_tcp_client_create_from_prepared_fd( + grpc_pollset_set* interested_parties, grpc_closure* closure, grpc_fd* fdobj, + const grpc_channel_args* channel_args, const grpc_resolved_address* addr, + grpc_millis deadline, grpc_endpoint** ep); + #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */ |