aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-06-06 00:24:21 +0000
committerFuwn <[email protected]>2021-06-06 00:24:21 +0000
commit7cebc1e93093c68c65ce1dfb540d2dd30a9159a0 (patch)
treec1568d3cd8ea95aba32b1ac41debad57b1a37f30
parentfix(whirl_server::hub): space between debug log message (diff)
downloadwhirl-7cebc1e93093c68c65ce1dfb540d2dd30a9159a0.tar.xz
whirl-7cebc1e93093c68c65ce1dfb540d2dd30a9159a0.zip
refactor(whirl_server): move orphan types out of orphan module
-rw-r--r--crates/whirl_server/src/interaction/peer.rs4
-rw-r--r--crates/whirl_server/src/interaction/shared.rs4
-rw-r--r--crates/whirl_server/src/lib.rs1
-rw-r--r--crates/whirl_server/src/types.rs8
4 files changed, 3 insertions, 14 deletions
diff --git a/crates/whirl_server/src/interaction/peer.rs b/crates/whirl_server/src/interaction/peer.rs
index 6a04b17..d7ac49e 100644
--- a/crates/whirl_server/src/interaction/peer.rs
+++ b/crates/whirl_server/src/interaction/peer.rs
@@ -9,11 +9,11 @@ use tokio::{
};
use tokio_util::codec::{BytesCodec, Framed};
-use crate::{interaction::shared::Shared, types::Rx};
+use crate::interaction::shared::Shared;
pub struct Peer {
pub bytes: Framed<TcpStream, BytesCodec>,
- pub rx: Rx,
+ pub rx: mpsc::UnboundedReceiver<bytes::BytesMut>,
}
impl Peer {
pub async fn new(
diff --git a/crates/whirl_server/src/interaction/shared.rs b/crates/whirl_server/src/interaction/shared.rs
index 7ad2510..91d7395 100644
--- a/crates/whirl_server/src/interaction/shared.rs
+++ b/crates/whirl_server/src/interaction/shared.rs
@@ -5,10 +5,8 @@ use std::collections::HashMap;
use bytes::BytesMut;
-use crate::types::Tx;
-
pub struct Shared {
- pub peers: HashMap<String, Tx>,
+ pub peers: HashMap<String, tokio::sync::mpsc::UnboundedSender<BytesMut>>,
}
impl Shared {
pub fn new() -> Self {
diff --git a/crates/whirl_server/src/lib.rs b/crates/whirl_server/src/lib.rs
index c1ff7e8..39cbf97 100644
--- a/crates/whirl_server/src/lib.rs
+++ b/crates/whirl_server/src/lib.rs
@@ -33,7 +33,6 @@ mod net;
pub mod distributor;
pub mod hub;
mod packet_parser;
-mod types;
use std::{error::Error, fmt, net::SocketAddr, sync::Arc};
diff --git a/crates/whirl_server/src/types.rs b/crates/whirl_server/src/types.rs
deleted file mode 100644
index 3d49752..0000000
--- a/crates/whirl_server/src/types.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use bytes::BytesMut;
-use tokio::sync::mpsc;
-
-pub type Tx = mpsc::UnboundedSender<BytesMut>;
-pub type Rx = mpsc::UnboundedReceiver<BytesMut>;