aboutsummaryrefslogtreecommitdiff
path: root/src/voice/connection.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2018-03-29 12:10:43 +0200
committeracdenisSK <[email protected]>2018-03-29 12:11:23 +0200
commit4c05e828d5191975ef1a5e1ac581b646a69d2c25 (patch)
treefb583f88a1e5d192651b399aca1839f3f58e661e /src/voice/connection.rs
parentAdd a connection timeout (diff)
downloadserenity-4c05e828d5191975ef1a5e1ac581b646a69d2c25.tar.xz
serenity-4c05e828d5191975ef1a5e1ac581b646a69d2c25.zip
Refactor imports/exports to use nested groups and better formatting
Diffstat (limited to 'src/voice/connection.rs')
-rw-r--r--src/voice/connection.rs62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/voice/connection.rs b/src/voice/connection.rs
index d447d5c..5c170c6 100644
--- a/src/voice/connection.rs
+++ b/src/voice/connection.rs
@@ -1,10 +1,20 @@
-use byteorder::{BigEndian, ByteOrder, LittleEndian, ReadBytesExt, WriteBytesExt};
+use byteorder::{
+ BigEndian,
+ ByteOrder,
+ LittleEndian,
+ ReadBytesExt,
+ WriteBytesExt
+};
use constants::VOICE_GATEWAY_VERSION;
use internal::prelude::*;
-use internal::ws_impl::{ReceiverExt, SenderExt};
-use internal::Timer;
-use model::event::VoiceEvent;
-use model::id::UserId;
+use internal::{
+ ws_impl::{ReceiverExt, SenderExt},
+ Timer
+};
+use model::{
+ event::VoiceEvent,
+ id::UserId
+};
use opus::{
packet as opus_packet,
Application as CodingMode,
@@ -16,20 +26,40 @@ use opus::{
use parking_lot::Mutex;
use serde::Deserialize;
use sodiumoxide::crypto::secretbox::{self, Key, Nonce};
-use std::collections::HashMap;
-use std::io::Write;
-use std::net::{SocketAddr, ToSocketAddrs, UdpSocket};
-use std::sync::mpsc::{self, Receiver as MpscReceiver, Sender as MpscSender};
-use std::sync::Arc;
-use std::thread::{self, Builder as ThreadBuilder, JoinHandle};
-use std::time::Duration;
+use std::{
+ collections::HashMap,
+ io::Write,
+ net::{SocketAddr, ToSocketAddrs, UdpSocket},
+ sync::{
+ mpsc::{
+ self,
+ Receiver as MpscReceiver,
+ Sender as MpscSender
+ },
+ Arc,
+ },
+ thread::{
+ self,
+ Builder as ThreadBuilder,
+ JoinHandle
+ },
+ time::Duration
+};
use super::audio::{AudioReceiver, AudioType, HEADER_LEN, SAMPLE_RATE, LockedAudio};
use super::connection_info::ConnectionInfo;
use super::{payload, VoiceError, CRYPTO_MODE};
-use websocket::client::Url as WebsocketUrl;
-use websocket::sync::client::ClientBuilder;
-use websocket::sync::stream::{AsTcpStream, TcpStream, TlsStream};
-use websocket::sync::Client as WsClient;
+use websocket::{
+ client::Url as WebsocketUrl,
+ sync::{
+ client::ClientBuilder,
+ stream::{
+ AsTcpStream,
+ TcpStream,
+ TlsStream
+ },
+ },
+ sync::Client as WsClient
+};
type Client = WsClient<TlsStream<TcpStream>>;