diff --git a/src/grisp_connect_ws.erl b/src/grisp_connect_ws.erl index b9f087f..8371208 100644 --- a/src/grisp_connect_ws.erl +++ b/src/grisp_connect_ws.erl @@ -23,7 +23,8 @@ }). -define(disconnected_state, - #state{gun_pid = undefined, gun_ref = undefine, ws_up = false}). + #state{gun_pid = undefined, gun_ref = undefine, + ws_up = false, ping_timer = undefined}). -include_lib("kernel/include/logger.hrl"). @@ -118,7 +119,7 @@ handle_info(M, S) -> % internal functions ----------------------------------------------------------- shutdown_gun(#state{gun_pid = Pid, gun_ref = GunRef, - ping_timer = PingTimer} = State) -> + ping_timer = PingTimer} = State) -> timer:cancel(PingTimer), demonitor(GunRef), gun:shutdown(Pid), diff --git a/test/grisp_connect_api_SUITE.erl b/test/grisp_connect_api_SUITE.erl index 1f17526..71e9819 100644 --- a/test/grisp_connect_api_SUITE.erl +++ b/test/grisp_connect_api_SUITE.erl @@ -72,7 +72,7 @@ link_device_test(_) -> ?assertMatch({ok, <<"pong">>}, grisp_connect:ping()). reconnect_on_gun_crash_test(_) -> - {state, GunPid, _, _, _} = sys:get_state(grisp_connect_ws), + {state, GunPid, _, _, _, _} = sys:get_state(grisp_connect_ws), proc_lib:stop(GunPid), ?assertMatch(ok, wait_disconnection()), ?assertMatch(ok, wait_connection()).