diff options
Diffstat (limited to 'src/gun.erl')
-rw-r--r-- | src/gun.erl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gun.erl b/src/gun.erl index a548a5d..bb275f5 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -1061,6 +1061,9 @@ handle_common(cast, Any, _, #state{owner=Owner}) when element(2, Any) =/= Owner element(2, Any) ! {gun_error, self(), {notowner, "Operations are restricted to the owner of the connection."}}, keep_state_and_data; +%% We postpone all HTTP/Websocket operations until we are connected. +handle_common(cast, _, StateName, _) when StateName =/= connected -> + {keep_state_and_data, postpone}; handle_common(Type, Event, StateName, StateData) -> error_logger:error_msg("Unexpected event in state ~p of type ~p:~n~w~n~p~n", [StateName, Type, Event, StateData]), |