diff options
| author | Zeyla Hellyer <[email protected]> | 2017-09-24 16:14:12 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-09-24 16:14:12 -0700 |
| commit | 5aaca63f9b2974f312e68adf6cb18bdadbdbb148 (patch) | |
| tree | b261633008490455f4ffc28ac4e55e2c82b3635a /src/voice/connection.rs | |
| parent | Add a shard manager (diff) | |
| download | serenity-5aaca63f9b2974f312e68adf6cb18bdadbdbb148.tar.xz serenity-5aaca63f9b2974f312e68adf6cb18bdadbdbb148.zip | |
Fix tests and example 05
Diffstat (limited to 'src/voice/connection.rs')
| -rw-r--r-- | src/voice/connection.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/voice/connection.rs b/src/voice/connection.rs index 620f19e..c134798 100644 --- a/src/voice/connection.rs +++ b/src/voice/connection.rs @@ -73,10 +73,10 @@ impl Connection { let hello = loop { match client.recv_json(VoiceEvent::decode)? { - VoiceEvent::Hello(received_hello) => { + Some(VoiceEvent::Hello(received_hello)) => { break received_hello; }, - VoiceEvent::Heartbeat(_) => continue, + Some(VoiceEvent::Heartbeat(_)) => continue, other => { debug!("[Voice] Expected hello/heartbeat; got: {:?}", other); @@ -388,7 +388,7 @@ fn generate_url(endpoint: &mut String) -> Result<WebsocketUrl> { fn encryption_key(client: &mut Client) -> Result<Key> { loop { match client.recv_json(VoiceEvent::decode)? { - VoiceEvent::Ready(ready) => { + Some(VoiceEvent::Ready(ready)) => { if ready.mode != CRYPTO_MODE { return Err(Error::Voice(VoiceError::VoiceModeInvalid)); } @@ -396,7 +396,7 @@ fn encryption_key(client: &mut Client) -> Result<Key> { return Key::from_slice(&ready.secret_key) .ok_or(Error::Voice(VoiceError::KeyGen)); }, - VoiceEvent::Unknown(op, value) => { + Some(VoiceEvent::Unknown(op, value)) => { debug!( "[Voice] Expected ready for key; got: op{}/v{:?}", op.num(), @@ -447,7 +447,7 @@ fn start_threads(client: Arc<Mutex<Client>>, udp: &UdpSocket) -> Result<ThreadIt let ws_thread = ThreadBuilder::new() .name(format!("{} WS", thread_name)) .spawn(move || loop { - while let Ok(msg) = client.lock().unwrap().recv_json(VoiceEvent::decode) { + while let Ok(Some(msg)) = client.lock().unwrap().recv_json(VoiceEvent::decode) { if tx_clone.send(ReceiverStatus::Websocket(msg)).is_ok() { return; } |