Skip to content

Commit

Permalink
Remove then to conform to older Elixir
Browse files Browse the repository at this point in the history
  • Loading branch information
haljin authored and Pawel Antemijczuk committed Jan 18, 2023
1 parent 08c250e commit f5408ae
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/websockex/conn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ defmodule WebSockex.Conn do
Keyword.get(opts, :socket_connect_timeout, @socket_connect_timeout_default),
socket_recv_timeout: Keyword.get(opts, :socket_recv_timeout, @socket_recv_timeout_default),
ssl_options: Keyword.get(opts, :ssl_options, nil),
socket_options: Keyword.get(opts, :socket_options, nil),
socket_options: Keyword.get(opts, :socket_options, nil)
}
end

Expand Down Expand Up @@ -145,13 +145,15 @@ defmodule WebSockex.Conn do
"""
@spec parse_host(String.t()) :: charlist() | :inet.ip_address()
def parse_host(host) do
host
|> to_charlist()
|> :inet.parse_address()
|> then(fn
parsed =
host
|> to_charlist()
|> :inet.parse_address()

case parsed do
{:error, :einval} -> to_charlist(host)
{:ok, addr} -> addr
end)
end
end

@doc """
Expand Down Expand Up @@ -347,8 +349,8 @@ defmodule WebSockex.Conn do
]
end


defp socket_connection_options(%{socket_options: socket_options}) when not is_nil(socket_options) do
defp socket_connection_options(%{socket_options: socket_options})
when not is_nil(socket_options) do
minimal_socket_connection_options()
|> Keyword.merge(socket_options)
end
Expand All @@ -357,7 +359,6 @@ defmodule WebSockex.Conn do
minimal_socket_connection_options()
end


# Crazy SSL Stuff (It will be normal SSL stuff when I figure out Erlang's ssl)

defp ssl_connection_options(%{ssl_options: ssl_options}) when not is_nil(ssl_options) do
Expand Down

0 comments on commit f5408ae

Please sign in to comment.