Deduplicate sockets by path

This commit is contained in:
bluepython508
2024-09-21 17:16:23 +01:00
parent df2c942fd7
commit 998c7e32a1
3 changed files with 34 additions and 33 deletions

View File

@@ -4,11 +4,11 @@ defmodule Frajtano.Peer do
use GenServer, restart: :temporary
def start(path) do
DynamicSupervisor.start_child(Frajtano.Peer, {__MODULE__, path})
DynamicSupervisor.start_child(Frajtano.PeerSupervisor, {__MODULE__, path})
end
def start_link(path) do
GenServer.start_link(__MODULE__, path)
GenServer.start_link(__MODULE__, path, name: {:via, Registry, {Frajtano.Peers, path}})
end
@impl true