diff options
author | Alex Auvolat <alex@adnab.me> | 2018-10-11 11:02:35 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-10-11 11:02:35 +0200 |
commit | 7b6042205e7c6135fae4e0d21dbf7a5975e8491b (patch) | |
tree | 58fc563458702fb456729b79802eacb547a8fc66 /shard/lib/net/tcpserver.ex | |
parent | a2f678dc510e642479d61b81148a433edd7b76fe (diff) | |
download | shard-7b6042205e7c6135fae4e0d21dbf7a5975e8491b.tar.gz shard-7b6042205e7c6135fae4e0d21dbf7a5975e8491b.zip |
Clean up
Diffstat (limited to 'shard/lib/net/tcpserver.ex')
-rw-r--r-- | shard/lib/net/tcpserver.ex | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/shard/lib/net/tcpserver.ex b/shard/lib/net/tcpserver.ex index 1aa5738..6cc3473 100644 --- a/shard/lib/net/tcpserver.ex +++ b/shard/lib/net/tcpserver.ex @@ -2,14 +2,15 @@ defmodule SNet.TCPServer do require Logger use Task, restart: :permanent - def start_link(port) do - Task.start_link(__MODULE__, :accept, [port]) + def start_link(_) do + Task.start_link(__MODULE__, :accept, []) end @doc """ Starts accepting connections on the given `port`. """ - def accept(port) do + def accept() do + port = Application.get_env(:shard, :port) {:ok, socket} = :gen_tcp.listen(port, [:binary, packet: 2, active: false, reuseaddr: true]) Logger.info "Accepting connections on port #{port}" |