![]() |
Bitcoin Core 29.99.0
P2P Digital Currency
|
Base class for generated ProxyServer classes that implement capnp server methods and forward calls to a wrapped c++ implementation class. More...
#include <proxy.h>
Public Types | |
using | Interface = Interface_ |
using | Impl = Impl_ |
Public Member Functions | |
ProxyServerBase (std::shared_ptr< Impl > impl, Connection &connection) | |
virtual | ~ProxyServerBase () |
ProxyServer destructor, called from the EventLoop thread by Cap'n Proto garbage collection code after there are no more references to this object. More... | |
void | invokeDestroy () |
If the capnp interface defined a special "destroy" method, as described the ProxyClientBase class, this method will be called and synchronously destroy m_impl before returning to the client. More... | |
Public Attributes | |
std::shared_ptr< Impl > | m_impl |
Implementation pointer that may or may not be owned and deleted when this capnp server goes out of scope. More... | |
ProxyContext | m_context |
Base class for generated ProxyServer classes that implement capnp server methods and forward calls to a wrapped c++ implementation class.
using mp::ProxyServerBase< Interface_, Impl_ >::Impl = Impl_ |
using mp::ProxyServerBase< Interface_, Impl_ >::Interface = Interface_ |
mp::ProxyServerBase< Interface, Impl >::ProxyServerBase | ( | std::shared_ptr< Impl > | impl, |
Connection & | connection | ||
) |
|
virtual |
ProxyServer destructor, called from the EventLoop thread by Cap'n Proto garbage collection code after there are no more references to this object.
Definition at line 464 of file proxy-io.h.
void mp::ProxyServerBase< Interface, Impl >::invokeDestroy |
If the capnp interface defined a special "destroy" method, as described the ProxyClientBase class, this method will be called and synchronously destroy m_impl before returning to the client.
If the capnp interface does not define a "destroy" method, this will never be called and the ~ProxyServerBase destructor will be responsible for deleting m_impl asynchronously, whenever the ProxyServer object gets garbage collected by Cap'n Proto.
This method is called in the same way other proxy server methods are called, via the serverInvoke function. Basically serverInvoke just calls this as a substitute for a non-existent m_impl->destroy() method. If the destroy method has any parameters or return values they will be handled in the normal way by PassField/ReadField/BuildField functions. Particularly if a Context.thread parameter was passed, this method will run on the worker thread specified by the client. Otherwise it will run on the EventLoop thread, like other server methods without an assigned thread.
Definition at line 514 of file proxy-io.h.
ProxyContext mp::ProxyServerBase< Interface_, Impl_ >::m_context |
std::shared_ptr<Impl> mp::ProxyServerBase< Interface_, Impl_ >::m_impl |
Implementation pointer that may or may not be owned and deleted when this capnp server goes out of scope.
It is owned for servers created to wrap unique_ptr<Impl> method arguments, but unowned for servers created to wrap Impl& method arguments.
In the case of Impl& arguments, custom code is required on other side of the connection to delete the capnp client & server objects since native code on that side of the connection will just be taking a plain reference rather than a pointer, so won't be able to do its own cleanup. Right now this is implemented with addCloseHook callbacks to delete clients at appropriate times depending on semantics of the particular method being wrapped.