Permalink
Browse files

support get_modules request in socket_server, since we have a dynamic…

… modules request (needed by release_manager)
  • Loading branch information...
1 parent 08a2a31 commit 931c5fb769be844c307a51596898ca6c55998219 @RJ committed Sep 8, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/mochiweb_socket_server.erl
@@ -258,6 +258,20 @@ handle_info({'EXIT', Pid, Reason},
ok
end,
{noreply, recycle_acceptor(Pid, State)};
+
+% this is what release_handler needs to get a list of modules,
+% since our supervisor modules list is set to 'dynamic'
+% see sasl-2.1.9.2/src/release_handler_1.erl get_dynamic_mods
+handle_info({From, Tag, get_modules}, State = #mochiweb_socket_server{name={local,Mod}}) ->
+ From ! {element(2,Tag), [Mod]},
+ {noreply, State};
+
+% If for some reason we can't get the module name, send empty list to avoid release_handler timeout:
+handle_info({From, Tag, get_modules}, State) ->
+ error_logger:info_msg("mochiweb_socket_server replying to dynamic modules request as '[]'~n",[]),
+ From ! {element(2,Tag), []},
+ {noreply, State};
+
handle_info(Info, State) ->
error_logger:info_report([{'INFO', Info}, {'State', State}]),
{noreply, State}.

0 comments on commit 931c5fb

Please sign in to comment.