Skip to content

Commit 4d4d4ad

Browse files
committed
Replace 'decode_obj_msg' with 'decode_bin_obj'.
1 parent 2637f9b commit 4d4d4ad

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

src/riak_repl2_fssink.erl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ handle_info({Proto, Socket, Data},
148148
State=#state{socket=Socket,transport=Transport}) when Proto==tcp; Proto==ssl ->
149149
%% aae strategy will not receive messages here
150150
Transport:setopts(Socket, [{active, once}]),
151-
case riak_repl_util:decode_obj_msg(Data) of
152-
{fs_diff_obj, RObj} ->
151+
case binary_to_term(Data) of
152+
{fs_diff_obj, BinObj} ->
153+
RObj = riak_repl_util:decode_bin_obj(BinObj),
153154
riak_repl_util:do_repl_put(RObj);
154155
Other ->
155156
gen_fsm:send_event(State#state.fullsync_worker, Other)

src/riak_repl_util.erl

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
sockname/2,
5757
deduce_wire_version_from_proto/1,
5858
encode_obj_msg/2,
59-
decode_obj_msg/1,
59+
decode_bin_obj/1,
6060
make_pg_proxy_name/1,
6161
make_pg_name/1,
6262
mode_12_enabled/1,
@@ -892,20 +892,8 @@ encode_obj(w0, RObj) ->
892892
encode_obj(W, RObj) ->
893893
to_wire(W, RObj).
894894

895-
decode_obj_msg(Data) ->
896-
Msg = binary_to_term(Data),
897-
case Msg of
898-
{fs_diff_obj, BObj} when is_binary(BObj) ->
899-
RObj = from_wire(BObj),
900-
{fs_diff_obj, RObj};
901-
{fs_diff_obj, {BTHash, BObj}} when is_binary(BObj) ->
902-
RObj = from_wire(BObj),
903-
{fs_diff_obj, {BTHash, RObj}};
904-
{fs_diff_obj, _} ->
905-
Msg;
906-
Other ->
907-
Other
908-
end.
895+
decode_bin_obj({BTHash, BinObj}) -> {BTHash, from_wire(BinObj)};
896+
decode_bin_obj(BinObj) -> from_wire(BinObj).
909897

910898
%% @doc Create binary wire formatted replication blob for riak 2.0+, complete with
911899
%% possible type, bucket and key for reconstruction on the other end. BinObj should be

0 commit comments

Comments
 (0)