Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

{active, once} was accidentally removed from handle_info({tcp,...}), …

…fixed.

Removed during fix for bz://719 in changeset b9682923139f410295800111fbae1a095079ebcf. Also removed checks for ok on gen_tcp:sent() so a huge crash dump is not generated if the other node goes down  - will be handled by handle_info({tcp_closed, Reason} ...).
  • Loading branch information...
commit 7bafe4bb9e435a85401f1b34b6420800f1aaa7b7 1 parent 7c6b339
@jonmeredith jonmeredith authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/riak_core_handoff_receiver.erl
View
11 src/riak_core_handoff_receiver.erl
@@ -58,7 +58,7 @@ handle_info({tcp_error, _Socket, _Reason}, State=#state{partition=Partition,coun
error_logger:info_msg("Handoff receiver for partition ~p exiting after processing ~p"
" objects~n", [Partition, Count]),
{stop, normal, State};
-handle_info({tcp, _Socket, Data}, State) ->
+handle_info({tcp, Socket, Data}, State) ->
[MsgType|MsgData] = Data,
case catch(process_message(MsgType, MsgData, State)) of
{'EXIT', Reason} ->
@@ -66,6 +66,7 @@ handle_info({tcp, _Socket, Data}, State) ->
"processing ~p objects: ~p\n", [State#state.count, Reason]),
{stop, normal, State};
NewState when is_record(NewState, state) ->
+ inet:setopts(Socket, [{active, once}]),
{noreply, NewState}
end.
@@ -77,22 +78,22 @@ process_message(?PT_MSG_INIT, MsgData, State=#state{vnode_mod=VNodeMod}) ->
State#state{partition=Partition, vnode=VNode};
process_message(?PT_MSG_OBJ, MsgData, State=#state{vnode=VNode, count=Count}) ->
Msg = {handoff_data, MsgData},
- ok = gen_fsm:sync_send_all_state_event(VNode, Msg, 60000),
+ gen_fsm:sync_send_all_state_event(VNode, Msg, 60000),
State#state{count=Count+1};
process_message(?PT_MSG_OLDSYNC, MsgData, State=#state{sock=Socket}) ->
- ok = gen_tcp:send(Socket, <<?PT_MSG_OLDSYNC:8,"sync">>),
+ gen_tcp:send(Socket, <<?PT_MSG_OLDSYNC:8,"sync">>),
<<VNodeModBin/binary>> = MsgData,
VNodeMod = binary_to_atom(VNodeModBin, utf8),
State#state{vnode_mod=VNodeMod};
process_message(?PT_MSG_SYNC, _MsgData, State=#state{sock=Socket}) ->
- ok = gen_tcp:send(Socket, <<?PT_MSG_SYNC:8, "sync">>),
+ gen_tcp:send(Socket, <<?PT_MSG_SYNC:8, "sync">>),
State;
process_message(?PT_MSG_CONFIGURE, MsgData, State) ->
ConfProps = binary_to_term(MsgData),
State#state{vnode_mod=proplists:get_value(vnode_mod, ConfProps),
partition=proplists:get_value(partition, ConfProps)};
process_message(_, _MsgData, State=#state{sock=Socket}) ->
- ok = gen_tcp:send(Socket, <<255:8,"unknown_msg">>),
+ gen_tcp:send(Socket, <<255:8,"unknown_msg">>),
State.
handle_cast(_Msg, State) -> {noreply, State}.
Please sign in to comment.
Something went wrong with that request. Please try again.