Fixes an issue where the `EventData` were not stored in reverse order, meaning that only the last added TimedEvent would be serviced.
This reverses the `Ord` for `EventData`, which should only be internally compared, allowing all timed events to be processed correctly in order.
Fixes#95.
Sending poison messages should suffice to kill the voice session: attempting to `.leave()`. Fixes#88.
This was tested using `cargo make ready` and the modified `serenity/voice/` example.
Includes two more small changes too small to warrant PRs.
1. Removes the `shard_count` parameter from `Songbird::twilight` & `Songbird::twilight_from_config` since the cluster contains it.
2. Drops the `Arc` wrapper around `Songbird` to match against an upcoming twilight 0.7 change
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.
Adds some additional logging around some critical sections, rarely hit (i.e., during shard reconnections) in pursuit of issue #69. It's strongly suspected to lie here, at any rate...
This PR does the following:
* Changes both `Reader::Extension` and `Reader::ExtensionSeek` to use `symphonia::io::MediaSource`.
* Removes the `File` and `Vec` variants of readers, instead opting to provide a `from_file` and `from_memory` associated function to create readers from the `File` and `Cursor<Vec<u8>>` implementations of `MediaSource`.
* Removes the ReadSeek trait.
* Added a dependency on `symphonia_core`. This crate has no additional dependencies.
This commit undoes #64 (and bumps the library MSRV accordingly), and modifies #60 to match the new `Call` connection handling.
This was tested using `cargo make ready`, and rustc v1.49.0 on `examples/serenity/voice`.
This PR makes many of the types under `EventContext` separate `#[non_exhaustive]` structs. This makes it more feasible to add further information to connection and packet events as required in future. On this note, driver (re)connection events now include the SSRC supplied by Discord and the domain name which was connected to.
In addition, this fixes global timed events to return a list of all live tracks, and extensively details/documents events at a high level.
This was tested using `cargo make ready`.
This is a simple organisational change which moves `crate::Bitrate` to `crate::driver::Bitrate` to slightly clean up the crate root.
This has been tested using `cargo make ready`.
This change fixes tasks hanging due to rare cases of messages being lost between full Discord reconnections by placing a configurable timeout on the `ConnectionInfo` responses. This is a companion fix to [serenity#1255](https://github.com/serenity-rs/serenity/pull/1255). To make this doable, `Config`s are now used by all versions of `Songbird`/`Call`, and relevant functions are added to simplify setup with configuration. These are now non-exhaustive, correcting an earlier oversight. For future extensibility, this PR moves the return type of `join`/`join_gateway` into a custom future (no longer leaking flume's `RecvFut` type).
Additionally, this fixes the Makefile's feature sets for driver/gateway-only compilation.
This is a breaking change in:
* the return types of `join`/`join_gateway`
* moving `crate::driver::Config` -> `crate::Config`,
* `Config` and `JoinError` becoming `#[non_breaking]`.
This was tested via `cargo make ready`, and by testing `examples/serenity/voice_receive` with various timeout settings.
This change increases the version of DiscoRTP, which fixes upstream issues in libpnet and allows additional RTCP types to be added over time without breaking semver. This is a breaking change for users explicitly matching on RTCP packet types, as DiscoRTP is exposed here.
This has been tested using `cargo make ready`.
Joining a channel returns a future which fires on receipt of two messages from discord (by locally storing a channel). However, joining this same channel again after a success returns only *one* such message, causing the command to hang until another join fires or the channel is left. This alters internal behaviour to correctly cancel an in-progress connection attempt, or return success with known data if such a connection is present.
This introduces a breaking change on `Call::update_state` to include the target `ChannelId`. The reason for this is that although the `ChannelId` of a target channel was being stored, server admins may move or kick a bot from its voice channel. This changes the true channel, and may accidentally trigger a "double join" elsewhere.
This fix was tested by using an example to have a bot join its channel twice, to do so in a channel it had been moved to, and to move from a channel it had been moved to.
Debugging work put forth by JellyWx and jtscuba suggests that this WS thread receive is ending up in a permanent failure loop. This adapts the timeout-less receive such that receive failures are properly propagated.
This was tested using `cargo make ready` and using the `voice_storage` example (although I cannot repro the locking behaviour myself).
Comments in #69 suggest this is fixed -- closes#69.
The upstream crate `spinning_top` used newer elements of rustc's std in a patch release, unknowingly bumping its MSRV to 1.49.0. This patch reverts to the older, compatible, version.
This has been tested by manually building `examples/serenity/voice` using rustc v1.48.0.
Closes#62.
Leaving (rather than removing) a call would cause the driver to crash as it would try to use a non-existent connection immediately after it had been invalidated.
This has been tested using a modified `examples/serenity/voice_storage`, felyne, and via `cargo make ready`.
Updates to the latest async-tungstenite version. This was tested by `cargo make ready` and by testing driver/gateway function via `examples/serenity/voice_storage`.
This is a simple addition to allow current connection state to be retrieved *after* establishment, even when using the voice driver.
This has been tested using `cargo make ready`, as it is fairly simple functionality.
This change reduces many log levels to debug, particularly where errors are likely to be triggered by undocumented Discord messages or by threads exiting in an unpredictable way. This also reduces the task entry/exit messages to `trace`.
This PR has been tested via `cargo make ready`, and by manually inspecting logs at `debug` and `info` levels running `examples/serenity/voice`.