AsyncClient::new reconnects by default, fixes disconnect logic
This commit is contained in:
parent
d8e08df464
commit
2fc8e1c1dd
2 changed files with 7 additions and 3 deletions
|
@ -11,6 +11,8 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
|
|||
where Connection variant contains any error type that implements connect::ServerConnectorError (!421)
|
||||
- `starttls::Error` no longer has `TokioXMPP` variant ; only tokio_xmpp::Error can contain starttls::Error,
|
||||
not the other way around (!421)
|
||||
- `AsyncClient::new` automatically reconnects by default (!436)
|
||||
- `AsyncClient::poll_next` properly closes stream with `Poll::Ready(None)` when disconnecting without auto reconnect (!436)
|
||||
|
||||
Version 4.0.0:
|
||||
2024-07-26 Maxime “pep” Buquet <pep@bouah.net>
|
||||
|
|
|
@ -47,7 +47,7 @@ enum ClientState<S: AsyncReadAndWrite> {
|
|||
}
|
||||
|
||||
impl Client<ServerConfig> {
|
||||
/// Start a new XMPP client using StartTLS transport
|
||||
/// Start a new XMPP client using StartTLS transport and autoreconnect
|
||||
///
|
||||
/// Start polling the returned instance so that it will connect
|
||||
/// and yield events.
|
||||
|
@ -58,7 +58,9 @@ impl Client<ServerConfig> {
|
|||
password: password.into(),
|
||||
server: ServerConfig::UseSrv,
|
||||
};
|
||||
Self::new_with_config(config)
|
||||
let mut client = Self::new_with_config(config);
|
||||
client.set_reconnect(true);
|
||||
client
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +155,7 @@ impl<C: ServerConnector> Stream for Client<C> {
|
|||
}
|
||||
ClientState::Disconnected => {
|
||||
self.state = ClientState::Disconnected;
|
||||
Poll::Pending
|
||||
Poll::Ready(None)
|
||||
}
|
||||
ClientState::Connecting(mut connect) => match Pin::new(&mut connect).poll(cx) {
|
||||
Poll::Ready(Ok(Ok(stream))) => {
|
||||
|
|
Loading…
Reference in a new issue