![]() |
Bitcoin Core 29.99.0
P2P Digital Currency
|
Test setup class creating a two way connection between a ProxyServer<FooInterface> object and a ProxyClient<FooInterface>. More...
Public Member Functions | |
TestSetup (bool client_owns_connection=true) | |
~TestSetup () | |
Public Attributes | |
std::function< void()> | server_disconnect |
std::function< void()> | client_disconnect |
std::promise< std::unique_ptr< ProxyClient< messages::FooInterface > > > | client_promise |
std::unique_ptr< ProxyClient< messages::FooInterface > > | client |
ProxyServer< messages::FooInterface > * | server {nullptr} |
std::thread | thread |
Thread variable should be after other struct members so the thread does not start until the other members are initialized. More... | |
Test setup class creating a two way connection between a ProxyServer<FooInterface> object and a ProxyClient<FooInterface>.
Provides client_disconnect and server_disconnect lambdas that can be used to trigger disconnects and test handling of broken and closed connections.
Accepts a client_owns_connection option to test different ProxyClient destroy_connection values and control whether destroying the ProxyClient object destroys the client Connection object. Normally it makes sense for this to be true to simplify shutdown and avoid needing to call client_disconnect manually, but false allows testing more ProxyClient behavior and the "IPC client method called after disconnect" code path.
|
inline |
std::unique_ptr<ProxyClient<messages::FooInterface> > mp::test::TestSetup::client |
std::function<void()> mp::test::TestSetup::client_disconnect |
std::promise<std::unique_ptr<ProxyClient<messages::FooInterface> > > mp::test::TestSetup::client_promise |
ProxyServer<messages::FooInterface>* mp::test::TestSetup::server {nullptr} |
std::function<void()> mp::test::TestSetup::server_disconnect |
std::thread mp::test::TestSetup::thread |