Browse Source

Make ranch_sup the owner of the ranch_server ets table

Should prove itself more robust when things go wrong.
Loïc Hoguin 12 years ago
parent
commit
b186d01367
2 changed files with 2 additions and 2 deletions
  1. 0 2
      src/ranch_server.erl
  2. 2 0
      src/ranch_sup.erl

+ 0 - 2
src/ranch_server.erl

@@ -95,8 +95,6 @@ remove_connection(ListenerPid) ->
 
 %% @private
 init([]) ->
-	?TAB = ets:new(?TAB, [
-		ordered_set, public, named_table, {write_concurrency, true}]),
 	{ok, #state{}}.
 
 %% @private

+ 2 - 0
src/ranch_sup.erl

@@ -33,6 +33,8 @@ start_link() ->
 %% supervisor.
 
 init([]) ->
+	ranch_server = ets:new(ranch_server, [
+		ordered_set, public, named_table, {write_concurrency, true}]),
 	Procs = [
 		{ranch_server, {ranch_server, start_link, []},
 			permanent, 5000, worker, [ranch_server]}