This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Adds TLS support to the elixir client and server #26
Open
cwertyar
wants to merge
4
commits into
discord:master
Choose a base branch
from
cwertyar:ssl-ex
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scohen
reviewed
Oct 18, 2018
ex/loqui/lib/loqui/client.ex
Outdated
send_buffer_size = opts[:sndbuf] | ||
recieve_buffer_size = opts[:recbuf] | ||
buffer_size = max(send_buffer_size, recieve_buffer_size) | ||
:inet.setopts(socket, [sndbuf: send_buffer_size, | ||
transport.setopts(socket, [sndbuf: send_buffer_size, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be done a little more cleanly with my suggestion below.
ex/loqui/lib/loqui/client.ex
Outdated
with :ok <- :gen_tcp.send(sock, upgrade_request(state)), | ||
{:ok, data} <- :gen_tcp.recv(sock, 0, recv_timeout), | ||
defp make_active_once(%State{sock: sock, transport: transport}=state) do | ||
:ok = transport.setopts(sock, [active: :once]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternate take here:
defp setopts(:ssl, socket, opts) do
:ssl.setopts(socket, opts)
end
defp setopts(:gen_tcp, socket, opts) do
:inet.setopts(socket, opts)
end
then you can just call setopts(transport, socket, opts)
everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the changes. Also did the same for getopts
.
scohen
reviewed
Oct 19, 2018
This looks good to me; I'm going to have @jhgg take a look too. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
transport
parameter to the client which can hold:gen_tcp
or:ssl
modules and is added to the client statetcp_opts
totransport_opts
to fit with the transport:gen_tcp
with calls to the transportmake_active_once
andupdate_socket_opts
to either call into:inet
or:ssl
based on the transportFixes #25