class type rpc_multiplex_controller =object
..end
method alive : bool
method event_system : Unixqueue.event_system
method getsockname : sockaddr
method getpeername : sockaddr
method protocol : Rpc.protocol
method peer_user_name : string option
method reading : bool
method read_eof : bool
method start_reading : ?peek:(unit -> unit) ->
?before_record:(int -> sockaddr -> in_rule) ->
when_done:((in_record * sockaddr)
result_eof -> unit) ->
unit -> unit
when_done
callback is invoked. The in_record
passed to when_done
is usually `Accept m
when m
is the
undecoded message string. For other types of in_record
see
the comments to before_record
below.
This starts one-time read job only, i.e. it is not restarted
after when_done
has been invoked.
It is an error to start reading several times at once.
peek
: This function is called immediately before a data chunk is
read from the underlying data connection.
before_record
: If passed, this function is called back whenever
a fragment of data is started. The integer is the so-far known
size of the
message in bytes. It is guaranteed that the function is
invoked once for every message fragment as long as the previous
fragments were accepted, and in total at least once
before when_done
. The result of the last before_record
call
determines what is returned as in_record
, e.g. a `Deny
rule
causes that a `Deny
result is passed to when_done
.
Also, for `Deny
and `Drop
no message buffer is
allocated (i.e. no memory consumption). For `Reject
, only
a very small buffer is allocated that only provides space for
the session identifier (xid).
When there is no before_record
function, `Accept
is passed
to when_done
.
method writing : bool
method start_writing : when_done:(unit result -> unit) ->
Rpc_packer.packed_value -> sockaddr -> unit
when_done
when it is written,
or an error condition is reached.
This starts one-time write job only, i.e. it is not restarted
after when_done
has been invoked.
It is an error to start writing several times at once.
method cancel_rd_polling : unit -> unit
before_record
callback function. Polling can be
resumed by calling start_reading
again.method abort_rw : unit -> unit
method start_shutting_down : when_done:(unit result -> unit) -> unit -> unit
when_done
callback is invoked reporting the success
or failure.
The underlying file descriptor (if any) is not closed. A shutdown
is only a protocol handshake. After a shutdown,read_eof
is true. Call inactivate
to close the descriptor.
method cancel_shutting_down : unit -> unit
when_done
callback is invoked with
the `Cancelled
.
It is no error if no shutdown is in progress.
method set_timeout : notify:(unit -> unit) -> float -> unit
notify
callback is invoked.method inactivate : unit -> unit