We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssdb_conn.erl parse_recv fun,when step =:= ?SSDB_STEP_DATA the last message can match <<BlockData:Size/binary-unit:8, $\n:8, $\n:8, Res/binary>> or <<BlockData:Size/binary-unit:8, $\n:8, Res/binary>> If the match <<BlockData:Size/binary-unit:8, $\n:8, Res/binary>>,step state = ?SSDB_STEP_SIZE,but it was the last message. solution: parse_recv(#ssdb_conn{step = ?SSDB_STEP_SIZE, data = Data} = State, InData) -> NewData = <<Data/binary, InData/binary>>, case binary:split(NewData, <<"\n">>) of [<<>>, <<>>] -> %% repair Reply = State#ssdb_conn.reply, State#ssdb_conn{step = ?SSDB_STEP_FINISH, size = 0, data = <<>>, reply = lists:reverse(Reply)}; [BinSize, BlockData] -> Size = erlang:binary_to_integer(BinSize), NewState = State#ssdb_conn{data = BlockData, size = Size, step = ?SSDB_STEP_DATA}, parse_recv(NewState, <<>>); %% parse data _ -> %% wait for get size State#ssdb_conn{data = NewData} end;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ssdb_conn.erl$\n:8, $ \n:8, Res/binary>> or <<BlockData:Size/binary-unit:8, $\n:8, Res/binary>>
parse_recv fun,when step =:= ?SSDB_STEP_DATA
the last message can match <<BlockData:Size/binary-unit:8,
If the match <<BlockData:Size/binary-unit:8, $\n:8, Res/binary>>,step state = ?SSDB_STEP_SIZE,but it was the last message.
solution:
parse_recv(#ssdb_conn{step = ?SSDB_STEP_SIZE, data = Data} = State, InData) ->
NewData = <<Data/binary, InData/binary>>,
case binary:split(NewData, <<"\n">>) of
[<<>>, <<>>] -> %% repair
Reply = State#ssdb_conn.reply,
State#ssdb_conn{step = ?SSDB_STEP_FINISH, size = 0, data = <<>>, reply = lists:reverse(Reply)};
[BinSize, BlockData] ->
Size = erlang:binary_to_integer(BinSize),
NewState = State#ssdb_conn{data = BlockData, size = Size, step = ?SSDB_STEP_DATA},
parse_recv(NewState, <<>>); %% parse data
_ ->
%% wait for get size
State#ssdb_conn{data = NewData}
end;
The text was updated successfully, but these errors were encountered: