mirror of
https://codeberg.org/demostf/sync.git
synced 2026-06-03 16:44:07 +02:00
switch to parity-ws
This commit is contained in:
parent
bfb03f2c30
commit
582287e8da
5 changed files with 239 additions and 222 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use enum_dispatch::enum_dispatch;
|
||||
use mio::Token;
|
||||
use ws::{Result, Sender};
|
||||
use parity_ws::{Result, Sender};
|
||||
|
||||
#[enum_dispatch(Client)]
|
||||
pub(crate) trait ClientTrait {
|
||||
|
|
@ -33,9 +33,9 @@ mod mock {
|
|||
use crate::client::ClientTrait;
|
||||
use crate::SyncCommand;
|
||||
use mio::Token;
|
||||
use parity_ws::Result;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use ws::Result;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct MockClient {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::{spawn_local_server, SyncCommand};
|
||||
use parity_ws::Sender;
|
||||
use portpicker::pick_unused_port;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use websocket_lite::{Client, ClientBuilder, Message, NetworkStream};
|
||||
use ws::Sender;
|
||||
|
||||
const DELAY: Duration = Duration::from_millis(50);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use mio::Token;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use parity_ws::{listen, CloseCode, Error, Handler, Message, Result};
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
use ws::{listen, CloseCode, Error, Handler, Message, Result};
|
||||
|
||||
mod client;
|
||||
|
||||
|
|
@ -190,10 +190,10 @@ impl Handler for Server {
|
|||
|
||||
/// Used to spawn a server in integration tests
|
||||
#[cfg(test)]
|
||||
pub fn spawn_local_server(port: u16) -> ws::Sender {
|
||||
pub fn spawn_local_server(port: u16) -> parity_ws::Sender {
|
||||
use parity_ws::WebSocket;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::thread::spawn;
|
||||
use ws::WebSocket;
|
||||
|
||||
let listen_address = format!("localhost:{}", port);
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ pub fn spawn_local_server(port: u16) -> ws::Sender {
|
|||
spawn(move || {
|
||||
let sessions: Rc<RefCell<HashMap<String, Session>>> = Rc::default();
|
||||
|
||||
let ws = WebSocket::new(|out: ws::Sender| Server {
|
||||
let ws = WebSocket::new(|out: parity_ws::Sender| Server {
|
||||
out: out.into(),
|
||||
sessions: sessions.clone(),
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue