Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handshake refactor #38

Merged
merged 2 commits into from
Apr 14, 2017
Merged

Handshake refactor #38

merged 2 commits into from
Apr 14, 2017

Conversation

mmmries
Copy link
Collaborator

@mmmries mmmries commented Apr 13, 2017

While working on #37 I was bugged by the fact that we had several functions in the Gnat module that were only useful for the handshake. I thought it would be nicer to let all of the handshake logic happen in its own module with just a simple {:ok, socket} or {:error, reason} return value.

I also didn't like constantly having to to do

socket_write(state.connection_settings, state.socket, "PING\r\n")

So I changed the socket_write and socket_close functions to just accept the entire state as the first argument and it extracts the options/socket as needed.

socket_write(state, "PING\r\n")

/cc @quixoten @film42 @newellista @jjcarstens @tallguy-hackett

@quixoten
Copy link
Contributor

👍

@mmmries mmmries merged commit 7853402 into master Apr 14, 2017
@mmmries mmmries deleted the handshake_refactor branch April 14, 2017 02:42
@film42
Copy link
Collaborator

film42 commented Apr 14, 2017

I'm not sure what kind of guarantees socket write has, but it might be better to queue these messages up in the event that your kernel's buffer fills. Ex: PING\r\n and PONG\r\n.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants