Add the irc_conn PID to the ETS table
authorMatt Mullins <mmullins@mmlx.us>
Thu, 1 Sep 2011 01:10:32 +0000 (20:10 -0500)
committerMatt Mullins <mmullins@mmlx.us>
Thu, 1 Sep 2011 01:10:32 +0000 (20:10 -0500)
irc/irc_conn.erl

index 2108db6..eb1c9ce 100644 (file)
@@ -29,6 +29,8 @@ start_link(Instance, Supervisor, TableId) ->
         {Instance, Supervisor, TableId}, []).
 
 init({Instance, Supervisor, TableId}) ->
+    ets:insert(TableId, {irc_conn_pid, self()}), % record the connection PID in the table
+
     {Instance, Config} = lists:keyfind(Instance, 1, config:get_config(irc)),
     {Host, Port, Nick, Realname, _Channels} = Config,
     {ok, Socket} = gen_tcp:connect(Host, Port, [list]),