Skip to content

Add TestServer.TCP#58

Draft
richard-ash wants to merge 1 commit into
mainfrom
richard/add-tcp
Draft

Add TestServer.TCP#58
richard-ash wants to merge 1 commit into
mainfrom
richard/add-tcp

Conversation

@richard-ash
Copy link
Copy Markdown
Collaborator

No description provided.

Base automatically changed from richard/add-ssh to main May 21, 2026 01:01
@richard-ash richard-ash force-pushed the richard/add-tcp branch 4 times, most recently from ed38120 to 75c5759 Compare May 24, 2026 19:37
Comment thread lib/test_server/tcp.ex
Comment on lines +174 to +175
@spec connect() :: {:ok, connection()}
def connect, do: connect([])
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connect is not really a good name as it implies that it connects to something when you call it. It should be something like init or similar, or connection if we want to keep it close to that terminology.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, does it even make sense to make this expectation? Wouldn't you just do separate instances for this?

defp accept_loop(instance, listen_socket) do
case :gen_tcp.accept(listen_socket) do
{:ok, socket} ->
pid = spawn_link(fn -> wait_for_socket(instance) end)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just call it the same so e.g. we do bind(instance) and then bind(instance, socket), it's the same thing. It could also be inlined here since it's so minimal and kinda belongs, the bind(intance) function is really not doing anything.

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.

2 participants