module Rpc_intf:sig..end
server should be the
bag of implementations that the calling side implements; it defaults to
Implementations.null (i.e., "I implement no RPCs").val __pa_ounit_275876e34cf609db118f3d84b799a790 : stringmodule type Connection =sig..end
server should be the
bag of implementations that the calling side implements; it defaults to
Implementations.null (i.e., "I implement no RPCs").with_close tries to create a t using the given reader and writer. If a
handshake error is the result, it calls on_handshake_error, for which the default
behavior is to raise an exception. If no error results, dispatch_queries is
called on t.
After dispatch_queries returns, if server is None, the t will be closed and
the deferred returned by dispatch_queries wil be determined immediately.
Otherwise, we'll wait until the other side closes the connection and then close t
and determine the deferred returned by dispatch_queries.
When the deferred returned by with_close becomes determined, both Reader.close
and Writer.close have finished.
serve implementations ~port ?on_handshake_error () starts a server with the given
implementation on port. The optional auth function will be called on all incoming
connections with the address info of the client and will disconnect the client
immediately if it returns false. This auth mechanism is generic and does nothing
other than disconnect the client - any logging or record of the reasons is the
responsibility of the auth function itself.
client ~host ~port () connects to the server at (host,port) and returns the
connection or an Error if a connection could not be made. It is the responsibility
of the caller to eventually call close.
with_client ~host ~port f connects to the server at (host,port) and runs f
until an exception is thrown or until the returned Deferred is fulfilled.