aboutsummaryrefslogtreecommitdiff
path: root/lib/octochat/acceptor.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/octochat/acceptor.ex')
-rw-r--r--lib/octochat/acceptor.ex7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/octochat/acceptor.ex b/lib/octochat/acceptor.ex
index 66d97fc..5730ee4 100644
--- a/lib/octochat/acceptor.ex
+++ b/lib/octochat/acceptor.ex
@@ -14,7 +14,12 @@ defmodule Octochat.Acceptor do
defp loop_acceptor(socket) do
{:ok, client} = :gen_tcp.accept(socket)
- :gen_tcp.close(client)
+ {:ok, pid} = Task.Supervisor.start_child(
+ Octochat.TaskSupervisor,
+ Octochat.Echo,
+ :serve,
+ [client])
+ :ok = :gen_tcp.controlling_process(client, pid)
loop_acceptor(socket)
end