diff --git a/doc/src/manual/gun.info.asciidoc b/doc/src/manual/gun.info.asciidoc index e3c19d3a..db0916d6 100644 --- a/doc/src/manual/gun.info.asciidoc +++ b/doc/src/manual/gun.info.asciidoc @@ -22,7 +22,8 @@ Info :: #{ origin_host => inet:hostname() | inet:ip_address(), origin_port => inet:port_number(), intermediaries => [Intermediary], - cookie_store => gun_cookies:cookie_store() + cookie_store => gun_cookies:cookie_store(), + state_name => atom() } Intermediary :: #{ type => connect | socks5, diff --git a/src/gun.erl b/src/gun.erl index 42bd409f..317faab7 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -447,7 +447,7 @@ set_owner(ServerPid, NewOwnerPid) -> -spec info(pid()) -> map(). info(ServerPid) -> - {_, #state{ + {CurrentStateName, #state{ owner=Owner, socket=Socket, transport=Transport, @@ -473,7 +473,8 @@ info(ServerPid) -> origin_host => OriginHost, origin_port => OriginPort, intermediaries => intermediaries_info(Intermediaries, []), - cookie_store => CookieStore + cookie_store => CookieStore, + state_name => CurrentStateName }, Info = case Socket of undefined -> diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl index 00b8eab1..6266df99 100644 --- a/test/gun_SUITE.erl +++ b/test/gun_SUITE.erl @@ -172,7 +172,7 @@ info(_) -> {ok, {_, Port}} = inet:sockname(ListenSocket), {ok, Pid} = gun:open("localhost", Port), {ok, _} = gen_tcp:accept(ListenSocket, 5000), - #{sock_ip := _, sock_port := _} = gun:info(Pid), + #{sock_ip := _, sock_port := _, state_name := connected} = gun:info(Pid), gun:close(Pid). keepalive_infinity(_) ->