Closed DavidAlphaFox closed 6 years ago
Looks good. I will merge, but just one thing. Could you please remove this comment?
%% In server mode the socket should not exit when a peer shutdown except pair mode ?
%% Please consider it.
%handle_info({'EXIT', PeerPid, {shutdown, _Reason}}, State) ->
% exit_peer(PeerPid, State),
% {stop, normal, State};
If you feel deleting this code is ok - just do it. It is better for future developers if the source code has no todo-comments in it. If you feel like it is a potential future problem, please open an issue.
Oh, and thanks for the patch!
Ok, I see.
I will open an issue to discuss this problem on chumak_socket:handle_info
, and my intended on peer_exit
.
Dear author
I'm still working on the problem which can cause a server crashed when another side exits. I think here are main reasons:
chumak_peer
exited which is caused bytcp_close
will causechumak_socket
to exit.gen_server:call
is made tochumak_peer
after it exited will cause the implementations to exit.So I comment the code blew in
chumak_socket
Previous patch I pushed still contains bugs. In this push, I distinguish between error and empty and check the result of
chumak_peer:incoming_queue_out
in implementations.So every implementations which use
chumak_peer:incoming_queue_out
will contain codes like below.Thank you very much.