From 5043b98d5301e41238afd15d271f5c6b68081b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 16 Sep 2019 20:02:36 +0200 Subject: Simplify HandshakeEvent --- src/gun_http.erl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/gun_http.erl') diff --git a/src/gun_http.erl b/src/gun_http.erl index 59b127f..576c013 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -298,12 +298,14 @@ handle_head(Data, State=#http_state{version=ClientVersion, content_handlers=Hand Protocols = maps:get(protocols, Destination, [http]), case Destination of #{transport := tls} -> - TLSOpts = maps:get(tls_opts, Destination, []), - TLSTimeout = maps:get(tls_handshake_timeout, Destination, infinity), - {[ - {origin, <<"https">>, NewHost, NewPort, connect}, - {tls_handshake, RealStreamRef, ReplyTo, TLSOpts, TLSTimeout, Protocols} - ], EvHandlerState1}; + HandshakeEvent = #{ + stream_ref => RealStreamRef, + reply_to => ReplyTo, + tls_opts => maps:get(tls_opts, Destination, []), + timeout => maps:get(tls_handshake_timeout, Destination, infinity) + }, + {[{origin, <<"https">>, NewHost, NewPort, connect}, + {tls_handshake, HandshakeEvent, Protocols}], EvHandlerState1}; _ -> case Protocols of [http] -> -- cgit v1.2.3