aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-06-25 14:52:33 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-06-25 14:52:33 +0300
commite7c3b57b8bc9e28b3d4bd78d941926a8671cc981 (patch)
treedaa190210cff37ea987211c7ca4cfcfa56173398
parentIntercept EXIT signal (diff)
Allow reconnecting from disconnected state
-rw-r--r--src/xmpp_stream_out.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/xmpp_stream_out.erl b/src/xmpp_stream_out.erl
index 3e777a7e9..502ff79f7 100644
--- a/src/xmpp_stream_out.erl
+++ b/src/xmpp_stream_out.erl
@@ -308,6 +308,17 @@ handle_cast(connect, #{remote_server := RemoteServer,
process_stream_end({dns, Why}, State)
end
end);
+handle_cast(connect, #{stream_state := disconnected} = State) ->
+ State1 = State#{stream_id => new_id(),
+ stream_encrypted => false,
+ stream_verified => false,
+ stream_authenticated => false,
+ stream_restarted => false,
+ stream_state => connecting},
+ State2 = maps:remove(ip, State1),
+ State3 = maps:remove(socket, State2),
+ State4 = maps:remove(socket_monitor, State3),
+ handle_cast(connect, State4);
handle_cast(connect, State) ->
%% Ignoring connection attempts in other states
noreply(State);