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 0959a9d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 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 @@ -148,12 +148,12 @@ defmodule WebSockex.Conn do
host
|> to_charlist()
|> :inet.parse_address()
|> then(fn
{:error, :einval} -> to_charlist(host)
{:ok, addr} -> addr
end)
|> handle_address()
end

defp handle_address({:error, :einval}), do: to_charlist(host)
defp handle_address({:ok, addr}), do: addr

@doc """
Sends data using the `conn_mod` module.
"""
Expand Down Expand Up @@ -347,8 +347,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 +357,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 0959a9d

Please sign in to comment.