1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
open! Core
open! Async
let name = "Unauthenticated Async RPC"
module Settings = struct
type t = unit [@@deriving bin_io, sexp]
end
let serve
?max_message_size
?buffer_age_limit
?handshake_timeout
?heartbeat_config
~implementations
~initial_connection_state
~where_to_listen
()
=
let make_transport fd ~max_message_size =
Rpc.Transport.of_fd ?buffer_age_limit fd ~max_message_size
in
Rpc.Connection.serve
?max_message_size
~make_transport
?handshake_timeout
?heartbeat_config
~implementations
~initial_connection_state
~where_to_listen
()
;;
let client
?implementations
?max_message_size
?buffer_age_limit
?handshake_timeout
?heartbeat_config
?description
()
where_to_connect
=
let make_transport fd ~max_message_size =
Rpc.Transport.of_fd ?buffer_age_limit fd ~max_message_size
in
Rpc.Connection.client
?implementations
?max_message_size
~make_transport
?handshake_timeout
?heartbeat_config
?description
where_to_connect
|> Deferred.Or_error.of_exn_result
;;
let with_client
?implementations
?max_message_size
?buffer_age_limit
?handshake_timeout
?heartbeat_config
()
where_to_connect
f
=
let make_transport fd ~max_message_size =
Rpc.Transport.of_fd ?buffer_age_limit fd ~max_message_size
in
Rpc.Connection.with_client
?implementations
?max_message_size
~make_transport
?handshake_timeout
?heartbeat_config
where_to_connect
f
|> Deferred.Or_error.of_exn_result
;;