Gateway: Add connection timeout, add Config to gateway. (#51)

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 commit is contained in:
Kyle Simpson
2021-03-29 19:51:13 +01:00
parent f449d4f679
commit 1fc3dc2259
18 changed files with 426 additions and 119 deletions

View File

@@ -14,18 +14,18 @@ command = "cargo"
dependencies = ["format"]
[tasks.build-gateway]
args = ["build", "--features", "serenity-rustls"]
args = ["build", "--no-default-features", "--features", "serenity-rustls"]
command = "cargo"
dependencies = ["format"]
[tasks.build-driver]
args = ["build", "--features", "driver,rustls"]
args = ["build", "--no-default-features", "--features", "driver,rustls"]
command = "cargo"
dependencies = ["format"]
[tasks.build-old-tokio]
command = "cargo"
args = ["build", "--features", "serenity-rustls-tokio-02,driver-tokio-02"]
args = ["build", "--no-default-features", "--features", "serenity-rustls-tokio-02,driver-tokio-02"]
dependencies = ["format"]
[tasks.build-variants]
@@ -45,7 +45,12 @@ command = "cargo"
args = ["bench", "--features", "internals,full-doc"]
[tasks.doc]
command = "cargo"
args = ["doc", "--features", "full-doc"]
[tasks.doc-open]
command = "cargo"
args = ["doc", "--features", "full-doc", "--open"]
[tasks.ready]
dependencies = ["format", "test", "build-variants", "build-examples", "doc", "clippy"]
dependencies = ["format", "test", "build-variants", "build-examples", "doc", "clippy"]