Skip to content

Commit 518c94d

Browse files
authored
Merge pull request webmachine#306 from mikpe/dont-store-local-fun-in-mochiweb-options
webmachine_mochiweb: change LoopFun to an {M,F,As} tuple
2 parents a93d85b + c208797 commit 518c94d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/webmachine_mochiweb.erl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ start(Options) ->
6363
webmachine_router:init_routes(DGroup, DispatchList),
6464
_ = [application_set_unless_env_or_undef(K, V) || {K, V} <- WMOptions],
6565
MochiName = list_to_atom(to_list(PName) ++ "_mochiweb"),
66-
LoopFun = fun(X) -> ?MODULE:loop(DGroup, X) end,
66+
LoopFun = {?MODULE, loop, [DGroup]},
6767
mochiweb_http:start([{name, MochiName}, {loop, LoopFun} | OtherOptions]).
6868

6969
stop() ->
@@ -74,10 +74,8 @@ stop() ->
7474
stop(Name) ->
7575
mochiweb_http:stop(Name).
7676

77-
-spec loop(any(),
78-
mochiweb_request()) ->
79-
ok.
80-
loop(Name, MochiReq) ->
77+
-spec loop(mochiweb_request(), any()) -> ok.
78+
loop(MochiReq, Name) ->
8179
case new_webmachine_req(MochiReq) of
8280
{{error, NewRequestError}, ErrorReq} ->
8381
handle_error(500, {error, NewRequestError}, ErrorReq);

0 commit comments

Comments
 (0)