summaryrefslogtreecommitdiff
path: root/src/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/types.rs')
-rw-r--r--src/types.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/types.rs b/src/types.rs
index eed69dd..73d51b8 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -3,10 +3,8 @@ use std::{
net::SocketAddr,
sync::Arc,
};
+use warp::ws::Message;
use tokio::sync::RwLock;
-use hyper_tungstenite::tungstenite::Message;
-use hyper::{ Response, Body };
-use futures::channel::mpsc::UnboundedSender;
use crate::minesweeper;
#[derive(Debug, Clone)]
@@ -32,12 +30,17 @@ pub enum MetaMove {
#[derive(Debug)]
pub struct Peer {
- pub tx: UnboundedSender<Message>,
+ pub tx: tokio::sync::mpsc::UnboundedSender<Message>,
pub seq_id: usize,
pub name: String,
pub position: (usize, usize),
}
-pub type HtmlResult = Result<Response<Body>, Response<Body>>;
-pub type MovReqTx = futures::channel::mpsc::UnboundedSender<MetaMove>;
+pub struct ConnData {
+ pub cmd_tx: CmdTx,
+ pub remote_addr: SocketAddr,
+ pub peers: PeerMap,
+}
+
+pub type CmdTx = tokio::sync::mpsc::UnboundedSender<MetaMove>;
pub type PeerMap = Arc<RwLock<HashMap<SocketAddr, Peer>>>;