From fbe58ec837cc3c84b08d701c82b95222738c775f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 3 Jan 2019 22:12:42 +0100 Subject: Consolidate origin server test helpers Also fixes an issue with switch_transport introduced when converting the Gun process to gen_statem. --- src/gun.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gun.erl') diff --git a/src/gun.erl b/src/gun.erl index f27e7f4..e74c43f 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -888,7 +888,8 @@ commands([{origin, _Scheme, Host, Port, Type}|Tail], commands(Tail, State#state{origin_host=Host, origin_port=Port, intermediaries=[Info|Intermediaries]}); commands([{switch_transport, Transport, Socket}|Tail], State) -> - commands(Tail, State#state{socket=Socket, transport=Transport}); + commands(Tail, active(State#state{socket=Socket, transport=Transport, + messages=Transport:messages()})); %% @todo The two loops should be reunified and this clause generalized. commands([{switch_protocol, Protocol=gun_ws, ProtoState}], State) -> {keep_state, keepalive_cancel(State#state{protocol=Protocol, protocol_state=ProtoState})}; -- cgit v1.2.3