Skip to content

Commit

Permalink
CA-403620: Drop the with_client_proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Ming Lu <[email protected]>
  • Loading branch information
minglumlu committed Jan 2, 2025
1 parent 01d079e commit 6d91109
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 48 deletions.
39 changes: 0 additions & 39 deletions ocaml/libs/stunnel/stunnel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -448,45 +448,6 @@ let with_connect ?unique_id ?use_fork_exec_helper ?write_to_log ~verify_cert
)
5
let with_client_proxy ~verify_cert ~remote_host ~remote_port ~local_host
~local_port f =
( try
D.debug "Clean up running stunnel client proxy if there is any ..." ;
let out, _ =
Forkhelpers.execute_command_get_output "/usr/sbin/fuser"
["-4k"; string_of_int local_port ^ "/tcp"]
in
D.debug "Killed running stunnel client proxy:%s" out
with
| Forkhelpers.Spawn_internal_error (stderr, stdout, process_status) -> (
match process_status with
| Unix.WEXITED 1 ->
D.debug "No running stunnel client proxy"
| _ ->
D.warn
"Cleaning up running stunnel client proxy returned unexpectedly: \
stdout=(%s); stderr=(%s)"
stdout stderr
)
) ;
retry
(fun () ->
let pid, _ =
attempt_one_connect
(`Local_host_port (local_host, local_port))
verify_cert remote_host remote_port
in
D.debug "Started a client proxy (pid:%s): %s:%s -> %s:%s"
(string_of_int (getpid pid))
local_host (string_of_int local_port) remote_host
(string_of_int remote_port) ;
Xapi_stdext_pervasives.Pervasiveext.finally
(fun () -> f ())
(fun () -> disconnect_with_pid ~wait:false ~force:true pid)
)
5
let with_client_proxy_systemd_service ~verify_cert ~remote_host ~remote_port
~local_host ~local_port ~service f =
let cmd_path = stunnel_path () in
Expand Down
9 changes: 0 additions & 9 deletions ocaml/libs/stunnel/stunnel.mli
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ val with_moved_exn : t -> (t -> 'd) -> 'd

val safe_release : t -> unit

val with_client_proxy :
verify_cert:verification_config option
-> remote_host:string
-> remote_port:int
-> local_host:string
-> local_port:int
-> (unit -> 'a)
-> 'a

val with_client_proxy_systemd_service :
verify_cert:verification_config option
-> remote_host:string
Expand Down

0 comments on commit 6d91109

Please sign in to comment.