Commit c85bb59d authored by Jason Fried's avatar Jason Fried Committed by Facebook Github Bot

ThriftServer and get_client support for bind address and unix sockets

Summary:
This diff fixes a bug in get_client flow where we accepted hostnames but didn't perform DNS resolution on them.  That has been fixed by constructing the SocketAddress passing true to allowNameLookup.

While writing a unittest for this I realized that we didn't support binding servers to localhost, so I allowed for doing so.

Then I realized that it would be pretty simple to extend both get_client and ThriftServer to allow for unix sockets.

Discovered that unittests waiting for server.get_address() could wait forever if there was some exception in server.serve(). So I propigated the exception to the get_address future if it is not .done().

I updated all callsites that could accept a hostname/ip to accept and ipaddress object.
I updated path to accept a str or a Pathlike to support pathlib.Path.

Reviewed By: ambv

Differential Revision: D6911229

fbshipit-source-id: 2919a720da6bfa79db85fe55de10e8519ea39c82
parent 51d23d49
...@@ -24,8 +24,10 @@ cdef extern from "folly/Unit.h" namespace "folly": ...@@ -24,8 +24,10 @@ cdef extern from "folly/Unit.h" namespace "folly":
cdef extern from "folly/futures/Promise.h" namespace "folly": cdef extern from "folly/futures/Promise.h" namespace "folly":
cdef cppclass cFollyPromise "folly::Promise"[T]: cdef cppclass cFollyPromise "folly::Promise"[T]:
cFollyPromise()
void setValue[M](M& value) void setValue[M](M& value)
void setException[E](E& value) void setException[E](E& value)
cFollyFuture[T] getFuture()
cdef extern from "folly/Executor.h" namespace "folly": cdef extern from "folly/Executor.h" namespace "folly":
cdef cppclass cFollyExecutor "folly::Executor": cdef cppclass cFollyExecutor "folly::Executor":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment