WIP: yank out io:format
This commit is contained in:
parent
3089288338
commit
d54c74f58a
4 changed files with 0 additions and 27 deletions
|
@ -277,12 +277,10 @@ net_server_loop(Sock, S) ->
|
|||
{RespBin, S2} =
|
||||
case machi_pb:decode_mpb_ll_request(Bin) of
|
||||
LL_req when LL_req#mpb_ll_request.do_not_alter == 2 ->
|
||||
io:format(user, "SSS low req ~p\n", [LL_req]),
|
||||
{R, NewS} = do_pb_ll_request(LL_req, S),
|
||||
{machi_pb:encode_mpb_ll_response(R), mode(low, NewS)};
|
||||
_ ->
|
||||
HL_req = machi_pb:decode_mpb_request(Bin),
|
||||
io:format(user, "SSS high req ~p\n", [HL_req]),
|
||||
1 = HL_req#mpb_request.do_not_alter,
|
||||
{R, NewS} = do_pb_hl_request(HL_req, make_high_clnt(S)),
|
||||
{machi_pb:encode_mpb_response(R), mode(high, NewS)}
|
||||
|
@ -291,7 +289,6 @@ io:format(user, "SSS high req ~p\n", [HL_req]),
|
|||
net_server_loop(Sock, S2);
|
||||
{error, SockError} ->
|
||||
Msg = io_lib:format("Socket error ~w", [SockError]),
|
||||
io:format(user, "\nSSS SockError ~p\n", [SockError]),
|
||||
R = #mpb_ll_response{req_id= <<>>,
|
||||
generic=#mpb_errorresp{code=1, msg=Msg}},
|
||||
Resp = machi_pb:encode_mpb_ll_response(R),
|
||||
|
@ -320,7 +317,6 @@ do_pb_ll_request(#mpb_ll_request{req_id=ReqID}, #state{pb_mode=high}=S) ->
|
|||
{machi_pb_translate:to_pb_response(ReqID, unused, Result), S};
|
||||
do_pb_ll_request(PB_request, S) ->
|
||||
Req = machi_pb_translate:from_pb_request(PB_request),
|
||||
io:format(user, "\nSSS Req ~p\n", [Req]),
|
||||
{ReqID, Cmd, Result, S2} =
|
||||
case Req of
|
||||
{RqID, {low_proj, _}=CMD} ->
|
||||
|
@ -338,14 +334,11 @@ do_pb_ll_request(PB_request, S) ->
|
|||
nope ->
|
||||
{foo, bar, baz}
|
||||
end,
|
||||
io:format(user, "\nSSS Result1 ~p\n", [Result]),
|
||||
io:format(user, "\nSSS Result2 ~p\n", [catch machi_pb_translate:to_pb_response(ReqID, Cmd, Result)]),
|
||||
{machi_pb_translate:to_pb_response(ReqID, Cmd, Result), S2}.
|
||||
|
||||
do_pb_ll_request2(EpochID, CMD, S) ->
|
||||
{Wedged_p, CurrentEpochID} = ets:lookup_element(S#state.etstab, epoch, 2),
|
||||
if Wedged_p == true ->
|
||||
io:format(user, "LINE ~s ~p : ~p\n", [?MODULE, ?LINE, ets:lookup_element(S#state.etstab, epoch, 2)]),
|
||||
{{error, wedged}, S};
|
||||
not ((not is_tuple(EpochID)) orelse EpochID == ?DUMMY_PV1_EPOCH)
|
||||
andalso
|
||||
|
@ -360,10 +353,8 @@ io:format(user, "LINE ~s ~p : ~p\n", [?MODULE, ?LINE, ets:lookup_element(S#state
|
|||
io:format(user, "\n\nTODO: wedge myself!\n\n", []),
|
||||
todo_wedge_myself
|
||||
end,
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
{{error, bad_epoch}, S};
|
||||
true ->
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
do_pb_ll_request3(CMD, S)
|
||||
end.
|
||||
|
||||
|
@ -398,10 +389,7 @@ do_pb_hl_request(#mpb_request{req_id=ReqID}, #state{pb_mode=low}=S) ->
|
|||
{machi_pb_translate:to_pb_response(ReqID, unused, Result), S};
|
||||
do_pb_hl_request(PB_request, S) ->
|
||||
{ReqID, Cmd} = machi_pb_translate:from_pb_request(PB_request),
|
||||
io:format(user, "\nSSS high Cmd ~p\n", [Cmd]),
|
||||
{Result, S2} = do_pb_hl_request2(Cmd, S),
|
||||
io:format(user, "\nSSS high Result1 ~p\n", [Result]),
|
||||
io:format(user, "\nSSS high Result2 ~p\n", [catch machi_pb_translate:to_pb_response(ReqID, Cmd, Result)]),
|
||||
{machi_pb_translate:to_pb_response(ReqID, Cmd, Result), S2}.
|
||||
|
||||
do_pb_hl_request2({high_echo, Msg}, S) ->
|
||||
|
@ -556,7 +544,6 @@ do_pb_server_write_chunk2(_File, Offset, Chunk, CSum_tag,
|
|||
end
|
||||
end,
|
||||
Size = iolist_size(Chunk),
|
||||
io:format(user, "LINE ~s ~p append/no/no/write @ offset ~w\n", [?MODULE, ?LINE, Offset]),
|
||||
case file:pwrite(FHd, Offset, Chunk) of
|
||||
ok ->
|
||||
OffsetHex = machi_util:bin_to_hexstr(<<Offset:64/big>>),
|
||||
|
@ -1148,7 +1135,6 @@ seq_append_server_loop(DataDir, Prefix, File, {FHd,FHc}=FH_, FileNum, Offset) ->
|
|||
receive
|
||||
{seq_append, From, Prefix, Chunk, CSum, Extra} ->
|
||||
if Chunk /= <<>> ->
|
||||
io:format(user, "LINE ~s ~p append/pwrite @ offset ~w FHd ~p\n", [?MODULE, ?LINE, Offset, FHd]),
|
||||
ok = file:pwrite(FHd, Offset, Chunk);
|
||||
true ->
|
||||
ok
|
||||
|
|
|
@ -622,14 +622,11 @@ do_pb_request_common(Sock, ReqID, Req) ->
|
|||
erase(bad_sock),
|
||||
try
|
||||
ReqBin = list_to_binary(machi_pb:encode_mpb_ll_request(Req)),
|
||||
io:format(user, "\nCCC Req ~p\n", [Req]),
|
||||
ok = w_send(Sock, ReqBin),
|
||||
case w_recv(Sock, 0) of
|
||||
{ok, RespBin} ->
|
||||
Resp = machi_pb:decode_mpb_ll_response(RespBin),
|
||||
io:format(user, "\nCCC Resp ~p\n", [Resp]),
|
||||
{ReqID2, Reply} = machi_pb_translate:from_pb_response(Resp),
|
||||
io:format(user, "\nCCC ReqID2 ~p Reply ~p\n", [ReqID2, Reply]),
|
||||
true = (ReqID == ReqID2 orelse ReqID2 == <<>>),
|
||||
Reply;
|
||||
{error, _}=Err ->
|
||||
|
|
|
@ -171,7 +171,6 @@ do_connect_to_pb_listener(P) ->
|
|||
{ok, Sock} = gen_tcp:connect(P#p_srvr.address, P#p_srvr.port,
|
||||
?PB_PACKET_OPTS ++
|
||||
[binary, {active, false}]),
|
||||
io:format(user, "HHC connected to ~p on sock ~p\n", [P, Sock]),
|
||||
Sock
|
||||
catch _X:_Y ->
|
||||
io:format(user, "\n~p ~p @ ~p\n", [_X, _Y, erlang:get_stacktrace()]),
|
||||
|
@ -179,7 +178,6 @@ io:format(user, "HHC connected to ~p on sock ~p\n", [P, Sock]),
|
|||
end.
|
||||
|
||||
do_send_sync(Cmd, S) ->
|
||||
io:format(user, "\nHHC Req ~p\n", [Cmd]),
|
||||
do_send_sync2(Cmd, S).
|
||||
|
||||
do_send_sync2({echo, String}, #state{sock=Sock}=S) ->
|
||||
|
@ -235,7 +233,6 @@ do_send_sync2({append_chunk, PlacementKey, Prefix, Chunk, CSum, ChunkExtra},
|
|||
chunk_extra=ChunkExtra},
|
||||
R1a = #mpb_request{req_id=ReqID, do_not_alter=1,
|
||||
append_chunk=Req},
|
||||
io:format(user, "HHC app on ~p req ~p\n", [Sock, R1a]),
|
||||
Bin1a = machi_pb:encode_mpb_request(R1a),
|
||||
ok = gen_tcp:send(Sock, Bin1a),
|
||||
{ok, Bin1B} = gen_tcp:recv(Sock, 0),
|
||||
|
|
|
@ -53,24 +53,18 @@ smoke_test2() ->
|
|||
try
|
||||
true = ?C:connected_p(Clnt),
|
||||
String = "yo, dawgggggggggggggggggggggggggggggggggg",
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
String = ?C:echo(Clnt, String),
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
|
||||
%% TODO: auth() is not implemented. Auth requires SSL.
|
||||
%% Probably ought to put client stuff that relies on SSL into
|
||||
%% a separate test module? Or separate test func?
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
{error, _} = ?C:auth(Clnt, "foo", "bar"),
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
|
||||
PK = <<>>,
|
||||
Prefix = <<"prefix">>,
|
||||
Chunk1 = <<"Hello, chunk!">>,
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
{ok, {Off1, Size1, File1}} =
|
||||
?C:append_chunk(Clnt, PK, Prefix, Chunk1, none, 0),
|
||||
io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
||||
Chunk2 = "It's another chunk",
|
||||
CSum2 = {client_sha, machi_util:checksum_chunk(Chunk2)},
|
||||
{ok, {Off2, Size2, File2}} =
|
||||
|
@ -85,7 +79,6 @@ io:format(user, "LINE ~s ~p\n", [?MODULE, ?LINE]),
|
|||
{iolist_to_binary(Chunk2), File2, Off2, Size2},
|
||||
{iolist_to_binary(Chunk3), File3, Off3, Size3}],
|
||||
[begin
|
||||
io:format(user, "HTT ~p ~p ~p\n", [Fl, Off, Sz]),
|
||||
{ok, Ch} = ?C:read_chunk(Clnt, Fl, Off, Sz)
|
||||
end || {Ch, Fl, Off, Sz} <- Reads],
|
||||
|
||||
|
|
Loading…
Reference in a new issue