]> granicus.if.org Git - ejabberd/commitdiff
Allow reconnecting from disconnected state
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 25 Jun 2018 11:52:33 +0000 (14:52 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 25 Jun 2018 11:52:33 +0000 (14:52 +0300)
src/xmpp_stream_out.erl

index 3e777a7e9f164edc8da95ce694ec72334c07da31..502ff79f70d8e0a5d1c1fb7dc14f30eb2c98fa9c 100644 (file)
@@ -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);