I’m probably missing something obvious here, but if I use gun:open
to connect to a host that does not exist, or a port that has nothing listening on it, I don’t receive any error-message back.
For example, attempting to connect to port 81 on www.google.com
(nothing is listening on port 81):
(xyz@machine)4> gun:open("www.google.com", 81, #{ protocols => [ http ], domain_lookup_timeout => 1000, connect_timeout => 1000, retry => 0 }).
{ok,<0.1218.0>}
(xyz@machine)5> flush().
ok
I would expect the flush
to return a gun_down
or gun_error
tuple, but nothing. Same when connecting to non-existent hostname www.google1.com
:
(xyz@machine)6> gun:open("www.google1.com", 81, #{ protocols => [ http ], domain_lookup_timeout => 1000, connect_timeout => 1000, retry => 0 }).
{ok,<0.1221.0>}
(xyz@machine)7> flush().
ok
I do receive a gun_up
when connecting to something that does exist:
(xyz@machine)2> gun:open("www.google.com", 80, #{ protocols => [ http ], domain_lookup_timeout => 1000, connect_timeout => 1000, retry => 0 }).
{ok,<0.1215.0>}
(xyz@machine)3> flush().
Shell got {gun_up,<0.1215.0>,http}
ok
What am I overlooking? Am I misconfiguring something, or am I supposed to detect such errors in a different way?
This is using gun-2.0.0-rc2
.
Thanks,