mirror of
https://github.com/zap-proto/ocaml-rpc.git
synced 2026-10-30 15:04:28 +00:00
This allows the callee to see where the results are to be sent. CapTP will be able to use this in future to implement the send-results-to optimisation. Also: - Rename `resolver#connect` to `resolver#resolve` and convert the old `resolve` method into a set of helpers that can be used with any resolver, rather than requiring every resolver to implement them. - Split structs and resolvers into separate types. `Local_struct_promise.make` now returns a `(promise, resolver)` pair. This is needed to support send-results-to, because we need to know that we don't need an answer locally in order to tell the peer to keep the results for itself. It also clarifies the ref-counting situation (resolvers aren't ref-counted, and it's OK for a promise's ref-count to reach zero before its resolver is called).
19 lines
423 B
OCaml
19 lines
423 B
OCaml
exception End_of_fuzz_data
|
|
|
|
let int limit =
|
|
try
|
|
let x = Char.code (input_char stdin) in
|
|
if limit < 0x100 then x mod limit
|
|
else (
|
|
let y = Char.code (input_char stdin) in
|
|
assert (limit < 0x10000);
|
|
(x lor (y lsl 8)) mod limit
|
|
)
|
|
with End_of_file -> raise End_of_fuzz_data
|
|
|
|
let array options =
|
|
options.(int (Array.length options))
|
|
|
|
let bool () =
|
|
Char.code (input_char stdin) land 1 = 1
|