aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-21 19:17:57 -0800
committerAustin Hellyer <[email protected]>2016-11-21 19:17:57 -0800
commit6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078 (patch)
treea6f0303ebcf4a474f603aaa5c8fff67409d42a17 /src/internal
parentAdd support for creating embed images (diff)
downloadserenity-6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078.tar.xz
serenity-6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078.zip
Re-organize the client module
Re-organize the client module, creating a `gateway` submodule, and splitting the connection into separate files in it. The connection was a conglomeration of a number of purposes, most of which are actually used elsewhere in the library and/or exposed to the user. Thus, it makes sense to separate each item in a gateway-specific module. By splitting the client module further, this is a re-organization for preliminary RPC support WRT the Client. Additionally, rename the Connection struct to a Shard. The Connection itself was not the actual connection, and was a higher-level interface to the real connection logic. A Shard is a more accurate representation of what it actually is.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/ws_impl.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/internal/ws_impl.rs b/src/internal/ws_impl.rs
index ab91dae..ea327fd 100644
--- a/src/internal/ws_impl.rs
+++ b/src/internal/ws_impl.rs
@@ -5,7 +5,7 @@ use websocket::message::{Message as WsMessage, Type as WsType};
use websocket::stream::WebSocketStream;
use websocket::ws::receiver::Receiver as WsReceiver;
use websocket::ws::sender::Sender as WsSender;
-use ::client::ConnectionError;
+use ::client::gateway::GatewayError;
use ::internal::prelude::*;
pub trait ReceiverExt {
@@ -25,8 +25,8 @@ impl ReceiverExt for Receiver<WebSocketStream> {
let representation = String::from_utf8_lossy(&message.payload)
.into_owned();
- Err(Error::Connection(ConnectionError::Closed(message.cd_status_code,
- representation)))
+ Err(Error::Gateway(GatewayError::Closed(message.cd_status_code,
+ representation)))
} else if message.opcode == WsType::Binary || message.opcode == WsType::Text {
let json: Value = if message.opcode == WsType::Binary {
try!(serde_json::from_reader(ZlibDecoder::new(&message.payload[..])))
@@ -44,8 +44,7 @@ impl ReceiverExt for Receiver<WebSocketStream> {
let representation = String::from_utf8_lossy(&message.payload)
.into_owned();
- Err(Error::Connection(ConnectionError::Closed(None,
- representation)))
+ Err(Error::Gateway(GatewayError::Closed(None, representation)))
}
}
}