This PR adds several enhancements to Driver connection logic: * Driver (re)connection attempts now have a default timeout of around 10s. * The driver will now attempt to retry full connection attempts using a user-provided strategy: currently, this defaults to 5 attempts under an exponential backoff strategy. * The driver will now fire `DriverDisconnect` events at the end of any session -- this unifies (re)connection failure events with session expiry as seen in #76, which should provide users with enough detail to know *which* voice channel to reconnect to. Users still need to be careful to read the session/channel IDs to ensure that they aren't overwriting another join. This has been tested using `cargo make ready`, and by setting low timeouts to force failures in the voice receive example (with some additional error handlers). Closes #68.
30 lines
704 B
Rust
30 lines
704 B
Rust
#![allow(missing_docs)]
|
|
|
|
use crate::{
|
|
driver::{connection::error::Error, Bitrate, Config},
|
|
events::{context_data::DisconnectReason, EventData},
|
|
tracks::Track,
|
|
ConnectionInfo,
|
|
};
|
|
use flume::Sender;
|
|
|
|
#[allow(clippy::large_enum_variant)]
|
|
#[derive(Debug)]
|
|
pub enum CoreMessage {
|
|
ConnectWithResult(ConnectionInfo, Sender<Result<(), Error>>),
|
|
RetryConnect(usize),
|
|
SignalWsClosure(usize, ConnectionInfo, Option<DisconnectReason>),
|
|
Disconnect,
|
|
SetTrack(Option<Track>),
|
|
AddTrack(Track),
|
|
SetBitrate(Bitrate),
|
|
AddEvent(EventData),
|
|
RemoveGlobalEvents,
|
|
SetConfig(Config),
|
|
Mute(bool),
|
|
Reconnect,
|
|
FullReconnect,
|
|
RebuildInterconnect,
|
|
Poison,
|
|
}
|