networking¶
In [ ]:
open rust.rust_operators
In [ ]:
//// test
open testing
rust¶
reqwest_response¶
In [ ]:
nominal reqwest_response =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"reqwest_wasm::Response\")>]\n#endif\ntype reqwest_Response = class end"
$'' : $'reqwest_Response'
)
reqwest_error¶
In [ ]:
nominal reqwest_error =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"reqwest_wasm::Error\")>]\n#endif\ntype reqwest_Error = class end"
$'' : $'reqwest_Error'
)
request_builder¶
In [ ]:
nominal request_builder =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"reqwest_wasm::RequestBuilder\")>]\n#endif\ntype reqwest_RequestBuilder = class end"
$'' : $'reqwest_RequestBuilder'
)
request_type¶
In [ ]:
union request_type =
| Get
| Post
request¶
In [ ]:
type request =
{
url : string
request_type : request_type
body : string
json : bool
auto_refresh : bool
}
new_request_get¶
In [ ]:
inl new_request_get (url : string) : request_builder =
inl url = join url
inl url = url |> sm'.to_std_string
inl url = join url
!\($'"reqwest_wasm::Client::builder().build().map_err(|err| err.to_string())?.get(!url)"')
new_request_post¶
In [ ]:
inl new_request_post (url : string) : request_builder =
inl url = join url
inl url = url |> sm'.to_std_string
inl url = join url
!\($'"reqwest_wasm::Client::builder().build().map_err(|err| err.to_string())?.post(!url)"')
request_send¶
In [ ]:
inl request_send (request : request_builder) : async.future_pin (resultm.result' reqwest_response reqwest_error) =
inl request = join request
!\($'"Box::pin(reqwest_wasm::RequestBuilder::send(!request))"')
request_body¶
In [ ]:
inl request_body (body : string) (request : request_builder) : request_builder =
inl body = body |> sm'.to_std_string
!\\(body, $'"reqwest_wasm::RequestBuilder::body(!request, $0)"')
request_header¶
In [ ]:
inl request_header (key : string) (value : string) (request : request_builder) : request_builder =
inl request = join request
inl key = key |> sm'.to_std_string
inl value = value |> sm'.to_std_string
!\\((key, value), $'"reqwest_wasm::RequestBuilder::header(!request, $0, $1)"')
request_json¶
In [ ]:
inl request_json forall t. (obj : t) (request : request_builder) : request_builder =
!\($'"reqwest_wasm::RequestBuilder::json(!request, &!obj)"')
response_text¶
In [ ]:
inl response_text (response : reqwest_response) : async.future_pin (resultm.result' sm'.std_string reqwest_error) =
!\($'"Box::pin(reqwest_wasm::Response::text(!response))"')
fsharp¶
tcp_client¶
In [ ]:
nominal tcp_client = $'System.Net.Sockets.TcpClient'
new_tcp_client¶
In [ ]:
inl new_tcp_client () : tcp_client =
$'new `tcp_client ()'
ip_address¶
In [ ]:
nominal ip_address = $'System.Net.IPAddress'
ip_address_parse¶
In [ ]:
inl ip_address_parse (s : string) : ip_address =
s |> $'`ip_address.Parse'
tcp_listener¶
In [ ]:
nominal tcp_listener = $'System.Net.Sockets.TcpListener'
new_tcp_listener¶
In [ ]:
inl new_tcp_listener (ip_address : ip_address) (port : i32) : tcp_listener =
$'new `tcp_listener (!ip_address, !port)'
listener_start¶
In [ ]:
inl listener_start (listener : tcp_listener) : () =
$'!listener.Start' ()
listener_stop¶
In [ ]:
inl listener_stop (listener : tcp_listener) : () =
$'!listener.Stop' ()
client_connect_async¶
In [ ]:
inl client_connect_async
(host : string)
(port : i32)
(ct : threading.cancellation_token)
(client : tcp_client)
: async.value_task
=
$'!client.ConnectAsync (!host, !port, !ct)'
test_port_open¶
In [ ]:
inl test_port_open host port : _ bool = async.new_async fun () =>
inl ct = async.cancellation_token () |> async.let'
inl client = new_tcp_client () |> use
try_unit
fun () =>
client |> client_connect_async host port ct |> async.await_value_task_unit |> async.do
return true
fun ex =>
inl ex = ex |> sm'.format_exception
trace Verbose
fun () => "networking.test_port_open"
fun () => { port ex }
return false
In [ ]:
//// test
test_port_open "127.0.0.1" 65536
|> async.run_with_timeout 120
|> _assert_eq (Some false)
00:00:00 v #1 networking.test_port_open / { port = 65536; ex = System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'port') }
__assert_eq / actual: US6_0 false / expected: US6_0 false
test_port_open_timeout¶
In [ ]:
inl test_port_open_timeout timeout host port : _ bool = async.new_async_unit fun () =>
test_port_open host port
|> async.run_with_timeout_async timeout
|> async.let'
|> function
| None => false
| Some result => result
|> return
In [ ]:
//// test
test_port_open_timeout 120 "127.0.0.1" 65535
|> async.run_synchronously
|> _assert_eq false
00:00:00 v #1 networking.test_port_open / { port = 65535; ex = System.AggregateException: One or more errors occurred. (Connection refused) }
__assert_eq / actual: false / expected: false
wait_for_port_access¶
In [ ]:
inl wait_for_port_access timeout status host port : _ i64 =
let rec loop retry : _ i64 = async.new_async_unit fun () =>
inl isPortOpen =
match timeout |> optionm'.unbox with
| None => test_port_open host port
| Some timeout => test_port_open_timeout timeout host port
|> async.let'
fix_condition
fun () => isPortOpen = status
fun () => retry |> return
fun () =>
if retry % 100 = 0 then
trace Verbose
fun () => "networking.wait_for_port_access"
fun () => { port retry timeout status }
async.sleep 10 |> async.do
loop (retry + 1) |> async.return_await
loop 1i64
In [ ]:
//// test
inl lock_port host port = async.new_async fun () =>
trace Debug (fun () => "_1") id
async.sleep 5000 |> async.do
inl listener = new_tcp_listener (host |> ip_address_parse) port |> use
trace Debug (fun () => "_2") id
listener |> listener_start
trace Debug (fun () => "_3") id
async.sleep 2000 |> async.do
trace Debug (fun () => "_4") id
$'!listener.Stop' ()
trace Debug (fun () => "_5") id
inl host = "127.0.0.1"
inl port = 5555i32
fun () =>
trace Debug (fun () => "1") id
inl child = lock_port host port |> async.start_child |> async.let'
trace Debug (fun () => "2") id
async.sleep 1 |> async.do
trace Debug (fun () => "3") id
inl retries1 = wait_for_port_access (None |> optionm'.box) true host port |> async.let'
trace Debug (fun () => "4") id
inl retries2 = wait_for_port_access (None |> optionm'.box) false host port |> async.let'
trace Debug (fun () => "5") id
child |> async.do
trace Debug (fun () => "6") id
(retries1, retries2) |> return
|> async.new_async_unit
|> async.run_with_timeout 20000
|> function
| Some (retries1, retries2) =>
retries1
|> _assert_between
if platform.is_windows () then 2i64 else 2
if platform.is_windows () then 5 else 1500
retries2
|> _assert_between
if platform.is_windows () then 80i64 else 80
if platform.is_windows () then 200 else 600
true
| _ => false
|> _assert_eq true
00:00:00 d #1 1 00:00:00 d #2 _1 00:00:00 d #3 2 00:00:00 d #4 3 00:00:00 v #5 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #6 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #7 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #8 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #9 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #10 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #11 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #12 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #13 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #14 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #15 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #16 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #17 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #18 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #19 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #20 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #21 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #22 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #23 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #24 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #25 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #26 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #27 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #28 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #29 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #30 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #31 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #32 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #33 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #34 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #35 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #36 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #37 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #38 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #39 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #40 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #41 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #42 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #43 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #44 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #45 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #46 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #47 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #48 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #49 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #50 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #51 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #52 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #53 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #54 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #55 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #56 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #57 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #58 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #59 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #60 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #61 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #62 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #63 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #64 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #65 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #66 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #67 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #68 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #69 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #70 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #71 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #72 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #73 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #74 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #75 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #76 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #77 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #78 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #79 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #80 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #81 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #82 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #83 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #84 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #85 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #86 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #87 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #88 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #89 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #90 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #91 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #92 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #93 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #94 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #95 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #96 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #97 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #98 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #99 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #100 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #101 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #102 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #103 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #104 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #105 networking.wait_for_port_access / { port = 5555; retry = 100; timeout = None; status = true } 00:00:01 v #106 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #107 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #108 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #109 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #110 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #111 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #112 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #113 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #114 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #115 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #116 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #117 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #118 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #119 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #120 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #121 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #122 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #123 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #124 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #125 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #126 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #127 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #128 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #129 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #130 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #131 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #132 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #133 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #134 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #135 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #136 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #137 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #138 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #139 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #140 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #141 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #142 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #143 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #144 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #145 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #146 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #147 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #148 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #149 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #150 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #151 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #152 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #153 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #154 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #155 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #156 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #157 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #158 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #159 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #160 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #161 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #162 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #163 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #164 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #165 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #166 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #167 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:01 v #168 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #169 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #170 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #171 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #172 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #173 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #174 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #175 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #176 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #177 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #178 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #179 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #180 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #181 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #182 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #183 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #184 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #185 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #186 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #187 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #188 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #189 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #190 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #191 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #192 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #193 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #194 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #195 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #196 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #197 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #198 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #199 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #200 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #201 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #202 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #203 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #204 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #205 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #206 networking.wait_for_port_access / { port = 5555; retry = 200; timeout = None; status = true } 00:00:02 v #207 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #208 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #209 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #210 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #211 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #212 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #213 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #214 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #215 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #216 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #217 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #218 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #219 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #220 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #221 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #222 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #223 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #224 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #225 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #226 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #227 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #228 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #229 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #230 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #231 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #232 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #233 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #234 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #235 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #236 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #237 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #238 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #239 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #240 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #241 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #242 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #243 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #244 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #245 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #246 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #247 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #248 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #249 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #250 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #251 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:02 v #252 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #253 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #254 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #255 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #256 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #257 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #258 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #259 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #260 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #261 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #262 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #263 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #264 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #265 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #266 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #267 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #268 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #269 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #270 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #271 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #272 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #273 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #274 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #275 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #276 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #277 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #278 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #279 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #280 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #281 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #282 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #283 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #284 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #285 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #286 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #287 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #288 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #289 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #290 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #291 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #292 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #293 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #294 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #295 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #296 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #297 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #298 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #299 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #300 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #301 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #302 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #303 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #304 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #305 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #306 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #307 networking.wait_for_port_access / { port = 5555; retry = 300; timeout = None; status = true } 00:00:03 v #308 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #309 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #310 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #311 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #312 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #313 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #314 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #315 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #316 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #317 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #318 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #319 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #320 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #321 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #322 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #323 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #324 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #325 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #326 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #327 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #328 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #329 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #330 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #331 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #332 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #333 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #334 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #335 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #336 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:03 v #337 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #338 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #339 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #340 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #341 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #342 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #343 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #344 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #345 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #346 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #347 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #348 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #349 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #350 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #351 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #352 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #353 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #354 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #355 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #356 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #357 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #358 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #359 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #360 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #361 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #362 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #363 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #364 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #365 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #366 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #367 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #368 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #369 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #370 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #371 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #372 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #373 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #374 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #375 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #376 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #377 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #378 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #379 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #380 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #381 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #382 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #383 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #384 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #385 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #386 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #387 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #388 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #389 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #390 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #391 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #392 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #393 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #394 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #395 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #396 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #397 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #398 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #399 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #400 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #401 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #402 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #403 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #404 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #405 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #406 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #407 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #408 networking.wait_for_port_access / { port = 5555; retry = 400; timeout = None; status = true } 00:00:04 v #409 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #410 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #411 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #412 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #413 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #414 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #415 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #416 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #417 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #418 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #419 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #420 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 v #421 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:05 d #422 _2 00:00:05 d #423 _3 00:00:05 d #424 4 00:00:06 v #425 networking.wait_for_port_access / { port = 5555; retry = 100; timeout = None; status = false } 00:00:07 d #426 _4 00:00:07 d #427 _5 00:00:07 v #428 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:07 d #429 5 00:00:07 d #430 6 __assert_between / actual: 414L / expected: struct (2L, 1500L) __assert_between / actual: 168L / expected: struct (80L, 600L) __assert_eq / actual: true / expected: true
In [ ]:
//// test
inl lock_port host port = async.new_async_unit fun () =>
trace Debug (fun () => "_1") id
async.sleep 500 |> async.do
inl listener = new_tcp_listener (ip_address_parse host) port |> use
trace Debug (fun () => "_2") id
listener |> listener_start
trace Debug (fun () => "_3") id
async.sleep 200 |> async.do
trace Debug (fun () => "_4") id
listener |> listener_stop
trace Debug (fun () => "_5") id
inl host = "127.0.0.1"
inl port = 5555
fun () =>
trace Debug (fun () => "1") id
inl child = lock_port host port |> async.start_child |> async.let'
trace Debug (fun () => "2") id
async.sleep 1 |> async.do
trace Debug (fun () => "3") id
inl retries1 = wait_for_port_access (Some 60 |> optionm'.box) true host port |> async.let'
trace Debug (fun () => "4") id
inl retries2 = wait_for_port_access (Some 60 |> optionm'.box) false host port |> async.let'
trace Debug (fun () => "5") id
child |> async.do
trace Debug (fun () => "6") id
(retries1, retries2) |> return
|> async.new_async_unit
|> async.run_with_timeout 2000
|> function
| Some (retries1, retries2) =>
retries1
|> _assert_between
if platform.is_windows () then 4i64 else 2
if platform.is_windows () then 15 else 150
retries2
|> _assert_between
if platform.is_windows () then 5i64 else 0
if platform.is_windows () then 20 else 60
true
| _ => false
|> _assert_eq true
00:00:00 d #1 1 00:00:00 d #2 _1 00:00:00 d #3 2 00:00:00 d #4 3 00:00:00 v #5 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #6 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #7 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #8 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #9 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #10 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #11 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #12 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #13 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #14 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #15 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #16 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #17 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #18 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #19 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #20 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #21 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #22 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #23 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #24 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #25 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #26 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #27 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #28 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #29 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #30 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #31 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #32 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #33 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #34 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #35 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #36 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #37 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #38 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #39 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #40 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #41 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #42 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #43 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #44 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 v #45 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 d #46 _2 00:00:00 d #47 _3 00:00:00 d #48 4 00:00:00 d #49 _4 00:00:00 d #50 _5 00:00:00 v #51 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 d #52 5 00:00:00 d #53 6 __assert_between / actual: 42L / expected: struct (2L, 150L) __assert_between / actual: 17L / expected: struct (0L, 60L) __assert_eq / actual: true / expected: true
get_available_port¶
In [ ]:
inl get_available_port timeout host initial_port : _ i32 =
let rec loop port = async.new_async_unit fun () =>
inl is_port_open =
match timeout |> optionm'.unbox with
| None => test_port_open host port
| Some timeout => test_port_open_timeout timeout host port
|> async.let'
fix_condition
fun () => is_port_open |> not
fun () => port |> return
fun () => loop (port + 1) |> async.return_await
loop initial_port
In [ ]:
//// test
inl lock_ports host port = async.new_async_unit fun () =>
trace Debug (fun () => "_1") id
inl listener1 = new_tcp_listener (ip_address_parse host) port |> use
inl listener2 = new_tcp_listener (ip_address_parse host) (port + 1) |> use
trace Debug (fun () => "_2") id
listener1 |> listener_start
listener2 |> listener_start
trace Debug (fun () => "_3") id
async.sleep 4000 |> async.do
trace Debug (fun () => "_4") id
listener1 |> listener_stop
listener2 |> listener_stop
trace Debug (fun () => "_5") id
inl host = "127.0.0.1"
inl port = 5555
fun () =>
trace Debug (fun () => "1") id
inl child = lock_ports host port |> async.start_child |> async.let'
trace Debug (fun () => "2") id
async.sleep 240 |> async.do
trace Debug (fun () => "3") id
inl available_port = get_available_port (None |> optionm'.box) host port |> async.let'
trace Debug (fun () => "4") id
inl retries = wait_for_port_access (None |> optionm'.box) false host port |> async.let'
trace Debug (fun () => "5") id
child |> async.do
trace Debug (fun () => "6") id
(available_port, retries) |> return
|> async.new_async_unit
|> async.run_with_timeout 15000
|> function
| Some (available_port, retries) =>
available_port |> _assert_eq (port + 2)
retries
|> _assert_between
if platform.is_windows () then 50i64 else 50
if platform.is_windows () then 150 else 1200
true
| _ => false
|> _assert_eq true
00:00:00 d #1 1 00:00:00 d #2 _1 00:00:00 d #3 2 00:00:00 d #4 _2 00:00:00 d #5 _3 00:00:00 d #6 3 00:00:00 v #7 networking.test_port_open / { port = 5557; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 d #8 4 00:00:01 v #9 networking.wait_for_port_access / { port = 5555; retry = 100; timeout = None; status = false } 00:00:02 v #10 networking.wait_for_port_access / { port = 5555; retry = 200; timeout = None; status = false } 00:00:03 v #11 networking.wait_for_port_access / { port = 5555; retry = 300; timeout = None; status = false } 00:00:04 d #12 _4 00:00:04 d #13 _5 00:00:04 v #14 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:04 d #15 5 00:00:04 d #16 6 __assert_eq / actual: 5557 / expected: 5557 __assert_between / actual: 314L / expected: struct (50L, 1200L) __assert_eq / actual: true / expected: true
In [ ]:
//// test
inl lock_ports host port = async.new_async_unit fun () =>
trace Debug (fun () => "_1") id
inl listener1 = new_tcp_listener (ip_address_parse host) port |> use
inl listener2 = new_tcp_listener (ip_address_parse host) (port + 1) |> use
trace Debug (fun () => "_2") id
listener1 |> listener_start
listener2 |> listener_start
trace Debug (fun () => "_3") id
async.sleep 400 |> async.do
trace Debug (fun () => "_4") id
listener1 |> listener_stop
listener2 |> listener_stop
trace Debug (fun () => "_5") id
inl host = "127.0.0.1"
inl port = 5555
fun () =>
trace Debug (fun () => "1") id
inl child = lock_ports host port |> async.start_child |> async.let'
trace Debug (fun () => "2") id
async.sleep 240 |> async.do
trace Debug (fun () => "3") id
inl available_port = get_available_port (Some 60 |> optionm'.box) host port |> async.let'
trace Debug (fun () => "4") id
inl retries = wait_for_port_access (Some 60 |> optionm'.box) false host port |> async.let'
trace Debug (fun () => "5") id
child |> async.do
trace Debug (fun () => "6") id
(available_port, retries) |> return
|> async.new_async_unit
|> async.run_with_timeout 1500
|> function
| Some (available_port, retries) =>
available_port |> _assert_eq (port + 2)
retries
|> _assert_between
(if platform.is_windows () then 2i64 else 1)
(if platform.is_windows () then 10 else 120)
true
| _ => false
|> _assert_eq true
00:00:00 d #1 1 00:00:00 d #2 2 00:00:00 d #3 _1 00:00:00 d #4 _2 00:00:00 d #5 _3 00:00:00 d #6 3 00:00:00 v #7 networking.test_port_open / { port = 5557; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 d #8 4 00:00:00 d #9 _4 00:00:00 d #10 _5 00:00:00 v #11 networking.test_port_open / { port = 5555; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:00 d #12 5 00:00:00 d #13 6 __assert_eq / actual: 5557 / expected: 5557 __assert_between / actual: 13L / expected: struct (1L, 120L) __assert_eq / actual: true / expected: true
main¶
In [ ]:
inl main () =
init_trace_state None
$'let test_port_open x = !test_port_open x' : ()
$'let test_port_open_timeout x = !test_port_open_timeout x' : ()
$'let wait_for_port_access x = !wait_for_port_access x' : ()
$'let get_available_port x = !get_available_port x' : ()