···3232 ?on_connection_reused () =
3333 (* Validate parameters *)
3434 if max_connections_per_endpoint <= 0 then
3535- invalid_arg
3636- (Printf.sprintf "max_connections_per_endpoint must be positive, got %d"
3737- max_connections_per_endpoint);
3535+ Fmt.invalid_arg "max_connections_per_endpoint must be positive, got %d"
3636+ max_connections_per_endpoint;
38373938 if max_idle_time <= 0.0 then
4040- invalid_arg
4141- (Printf.sprintf "max_idle_time must be positive, got %.2f" max_idle_time);
3939+ Fmt.invalid_arg "max_idle_time must be positive, got %.2f" max_idle_time;
42404341 if max_connection_lifetime <= 0.0 then
4444- invalid_arg
4545- (Printf.sprintf "max_connection_lifetime must be positive, got %.2f"
4646- max_connection_lifetime);
4242+ Fmt.invalid_arg "max_connection_lifetime must be positive, got %.2f"
4343+ max_connection_lifetime;
47444845 (match max_connection_uses with
4946 | Some n when n <= 0 ->
5050- invalid_arg
5151- (Printf.sprintf "max_connection_uses must be positive, got %d" n)
4747+ Fmt.invalid_arg "max_connection_uses must be positive, got %d" n
5248 | _ -> ());
53495450 if connect_timeout <= 0.0 then
5555- invalid_arg
5656- (Printf.sprintf "connect_timeout must be positive, got %.2f"
5757- connect_timeout);
5151+ Fmt.invalid_arg "connect_timeout must be positive, got %.2f" connect_timeout;
58525953 if connect_retry_count < 0 then
6060- invalid_arg
6161- (Printf.sprintf "connect_retry_count must be non-negative, got %d"
6262- connect_retry_count);
5454+ Fmt.invalid_arg "connect_retry_count must be non-negative, got %d"
5555+ connect_retry_count;
63566457 if connect_retry_delay <= 0.0 then
6565- invalid_arg
6666- (Printf.sprintf "connect_retry_delay must be positive, got %.2f"
6767- connect_retry_delay);
5858+ Fmt.invalid_arg "connect_retry_delay must be positive, got %.2f"
5959+ connect_retry_delay;
68606961 {
7062 max_connections_per_endpoint;
+2-3
lib/endpoint.ml
···1515let v ~host ~port =
1616 (* Validate port range *)
1717 if port < 1 || port > 65535 then
1818- invalid_arg
1919- (Printf.sprintf "Invalid port number: %d (must be 1-65535)" port);
1818+ Fmt.invalid_arg "Invalid port number: %d (must be 1-65535)" port;
20192120 (* Validate hostname is not empty *)
2221 if String.trim host = "" then invalid_arg "Hostname cannot be empty";
···2726let port t = t.port
2827let equal t1 t2 = String.equal t1.host t2.host && t1.port = t2.port
2928let hash t = Hashtbl.hash (t.host, t.port)
3030-let pp = Fmt.of_to_string (fun t -> Printf.sprintf "%s:%d" t.host t.port)
2929+let pp = Fmt.of_to_string (fun t -> Fmt.str "%s:%d" t.host t.port)