Change ranch callback module name

This commit is contained in:
Shunichi Shinohara 2015-12-07 14:46:08 +09:00
parent a1f5a6ce62
commit 14765a7279
3 changed files with 11 additions and 9 deletions

View file

@ -207,7 +207,7 @@ append_server_loop(FluPid, #state{wedged=Wedged_p,
receive
{seq_append, From, _N, _L, _Prefix, _Chunk, _CSum, _Extra, _EpochID}
when Witness_p ->
%% The FLU's net_server_loop() process ought to filter all
%% The FLU's machi_flu1_net_server process ought to filter all
%% witness states, but we'll keep this clause for extra
%% paranoia.
From ! witness,

View file

@ -24,7 +24,7 @@
%% TODO
%% - Two modes, high and low should be separated at listener level?
-module(machi_pb_protocol).
-module(machi_flu1_net_server).
-behaviour(gen_server).
-behaviour(ranch_protocol).
@ -136,7 +136,9 @@ code_change(_OldVsn, S, _Extra) ->
-spec transport_received(socket(), machi_dt:chunk(), state()) ->
{noreply, state()}.
transport_received(Sock, Bin, #state{transport=Transport}=S) ->
transport_received(Socket, <<"QUIT\n">>, #state{socket=Socket}=S) ->
{stop, normal, S};
transport_received(Socket, Bin, #state{transport=Transport}=S) ->
{RespBin, S2} =
case machi_pb:decode_mpb_ll_request(Bin) of
LL_req when LL_req#mpb_ll_request.do_not_alter == 2 ->
@ -149,15 +151,15 @@ transport_received(Sock, Bin, #state{transport=Transport}=S) ->
{machi_pb:encode_mpb_response(R), mode(high, NewS)}
end,
if RespBin == async_no_response ->
Transport:setopts(Sock, [{active, once}]),
Transport:setopts(Socket, [{active, once}]),
{noreply, S2};
true ->
case Transport:send(Sock, RespBin) of
case Transport:send(Socket, RespBin) of
ok ->
Transport:setopts(Sock, [{active, once}]),
Transport:setopts(Socket, [{active, once}]),
{noreply, S2};
{error, Reason} ->
transport_error(Sock, Reason, S2)
transport_error(Socket, Reason, S2)
end
end.

View file

@ -72,7 +72,7 @@ child_spec(FluName, TcpPort, Witness, DataDir, EpochTab, ProjStore) ->
ListenerName = make_listener_name(FluName),
NbAcceptors = 100,
TcpOpts = [{port, TcpPort}, {backlog, ?BACKLOG}],
ProtoOpts = [FluName, Witness, DataDir, EpochTab, ProjStore],
NetServerOpts = [FluName, Witness, DataDir, EpochTab, ProjStore],
ranch:child_spec(ListenerName, NbAcceptors,
ranch_tcp, TcpOpts,
machi_pb_protocol, ProtoOpts).
machi_flu1_net_server, NetServerOpts).