Skip to content

Commit

Permalink
'Unable to service recovery request when requested count is bigger th…
Browse files Browse the repository at this point in the history
…an configured maximum request count' now is a warning instead of an error.
  • Loading branch information
Ethan Yang committed Jan 6, 2016
1 parent 86376b1 commit 6eecfd0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/molderl_recovery.erl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ handle_info({udp, _Client, IP, Port, <<SessionName:10/binary,SequenceNumber:64/b
ok = gen_udp:send(State#state.socket, IP, Port, Payload),
lager:debug("[molderl] Replied recovery request from ~p - reply contains ~p messages", [IP, NumMsgs]);

{warning, Reason} ->
lager:warning("[molderl] Unable to service recovery request from ~p because ~s. Ignoring.", [IP, Reason])

{error, Reason} ->
lager:error("[molderl] Unable to service recovery request from ~p because ~s. Ignoring.", [IP, Reason])
end,
Expand Down Expand Up @@ -151,10 +154,10 @@ terminate(Reason, State) ->
%% request count is smaller than the maximum request count.
%% ------------------------------------------------------------
-spec validate_request(integer(), integer(), pos_integer(), pos_integer()) ->
'ok' | {'error', string()}.
'ok' | {'warning', string()} | {'error', string()}.
validate_request(_SeqNum, Count, _MaxSeqNum, MaxCount) when Count>MaxCount ->
Fmt = "requested count ~p is bigger than configured maximum request count ~p",
{error, io_lib:format(Fmt, [Count, MaxCount])};
{warning, io_lib:format(Fmt, [Count, MaxCount])};
validate_request(SeqNum, _Count, _MaxSeqNum, _MaxCount) when SeqNum =< 0 ->
Fmt = "requested sequence number ~p is smaller or equal to zero",
{error, io_lib:format(Fmt, [SeqNum])};
Expand Down

0 comments on commit 6eecfd0

Please sign in to comment.