Closed benbro closed 2 years ago
Thanks, that looks like another easy fix. It either needs to just ignore that message or handle it the same as EXIT
:
handle_event(info, {'EXIT', Socket, _Reason}, Data=#data{conn=Socket}) ->
%% socket died, go to disconnected state
{next_state, disconnected, Data#data{conn=undefined},
[{next_event, internal, connect}]}.
The reason I say it might be ok to ignore it is the EXIT
message should already be handling this case of the socket closing.
Will definitely need a catch all at the end because if we get both these messages it means one of them will fail the function header match on Socket
in the message and conn=Socket
in the function header, preventing from leaking sockets and twice running moving to disconnected
state and setting conn
to undefined
.
So which one? Ignore it or handle it the same as 'EXIT'?
Sorry. Both actually.
A function that handles it the same as EXIT and one that is a catch all. Because it matches on 2 Socket
variables this will ensure it doesn't happen twice, so we can just handle it no matter which we get first.
Resolved by #58
pgo/src/pgo_connection.erl, line 119 https://github.com/erleans/pgo/blob/master/src/pgo_connection.erl#L119