Skip to content

Commit

Permalink
Downgrade to tokio alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
dbcfd committed Nov 30, 2019
1 parent ae05b6c commit b9b1c7d
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 26 deletions.
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ edition = "2018"

[features]
default = ["connect"]
connect = ["stream", "tokio/net"]
connect = ["stream", "tokio-net"]
tls = ["native-tls", "tokio-tls", "stream", "tungstenite/tls"]
stream = []

[dependencies]
log = "0.4"
futures = "0.3"
futures-preview = "0.3.0-alpha.19"
pin-project = "0.4"
tokio = "0.2"
tokio-io = { version = "0.2.0-alpha.6", features = ["util"] }
tokio-net = { version = "0.2.0-alpha.6", optional = true, features = ["tcp"] }

[dependencies.tungstenite]
version = "0.9.2"
Expand All @@ -33,9 +34,9 @@ version = "0.2.0"

[dependencies.tokio-tls]
optional = true
version = "0.3"
version = "0.3.0-alpha.6"

[dev-dependencies]
tokio = { version = "0.2", features = ["net", "macros", "rt-threaded", "io-std", "io-util"] }
url = "2.0.0"
tokio = "=0.2.0-alpha.6"
url = "2.0"
env_logger = "0.6"
2 changes: 1 addition & 1 deletion examples/autobahn-server.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use futures::{SinkExt, StreamExt};
use log::*;
use std::net::{SocketAddr, ToSocketAddrs};
use tokio::net::{TcpListener, TcpStream};
use tokio::net::tcp::{TcpListener, TcpStream};
use tokio_tungstenite::accept_async;

async fn accept_connection(peer: SocketAddr, stream: TcpStream) {
Expand Down
2 changes: 1 addition & 1 deletion examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use futures::{SinkExt, StreamExt};
use log::*;
use tungstenite::protocol::Message;

use tokio::io::AsyncReadExt;
use tokio_io::AsyncReadExt;
use tokio_tungstenite::connect_async;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
use futures::{SinkExt, StreamExt};
use log::*;
use std::net::{SocketAddr, ToSocketAddrs};
use tokio::net::{TcpListener, TcpStream};
use tokio_net::tcp::{TcpListener, TcpStream};
use tungstenite::protocol::Message;

struct Connection {
Expand Down
2 changes: 1 addition & 1 deletion examples/split-client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use futures::{SinkExt, StreamExt};
use log::*;
use tungstenite::protocol::Message;

use tokio::io::AsyncReadExt;
use tokio_io::AsyncReadExt;
use tokio_tungstenite::connect_async;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::task::{Context, Poll};

use futures::task;
use std::sync::Arc;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_io::{AsyncRead, AsyncWrite};
use tungstenite::Error as WsError;

pub(crate) enum ContextWaker {
Expand Down
8 changes: 4 additions & 4 deletions src/connect.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Connection helper.
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::net::TcpStream;
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_net::tcp::TcpStream;

use tungstenite::client::url_mode;
use tungstenite::handshake::client::Response;
Expand All @@ -13,7 +13,7 @@ pub(crate) mod encryption {
use native_tls::TlsConnector;
use tokio_tls::{TlsConnector as TokioTlsConnector, TlsStream};

use tokio::io::{AsyncRead, AsyncWrite};
use tokio_io::{AsyncRead, AsyncWrite};

use tungstenite::stream::Mode;
use tungstenite::Error;
Expand Down Expand Up @@ -54,7 +54,7 @@ pub use self::encryption::MaybeTlsStream;

#[cfg(not(feature = "tls"))]
pub(crate) mod encryption {
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_io::{AsyncRead, AsyncWrite};

use tungstenite::stream::Mode;
use tungstenite::Error;
Expand Down
2 changes: 1 addition & 1 deletion src/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::future::Future;
use std::io::{Read, Write};
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_io::{AsyncRead, AsyncWrite};
use tungstenite::handshake::client::Response;
use tungstenite::handshake::server::Callback;
use tungstenite::handshake::{HandshakeError as Error, HandshakeRole, MidHandshake as WsHandshake};
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use futures::{Sink, SinkExt, Stream};
use log::*;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_io::{AsyncRead, AsyncWrite};

use tungstenite::{
error::Error as WsError,
Expand Down Expand Up @@ -322,7 +322,7 @@ mod tests {
use crate::connect::encryption::AutoStream;
use crate::WebSocketStream;
use std::io::{Read, Write};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio_io::{AsyncReadExt, AsyncWriteExt};

fn is_read<T: Read>() {}
fn is_write<T: Write>() {}
Expand All @@ -332,16 +332,16 @@ mod tests {

#[test]
fn web_socket_stream_has_traits() {
is_read::<AllowStd<tokio::net::TcpStream>>();
is_write::<AllowStd<tokio::net::TcpStream>>();
is_read::<AllowStd<tokio_net::tcp::TcpStream>>();
is_write::<AllowStd<tokio_net::tcp::TcpStream>>();

#[cfg(feature = "connect")]
is_async_read::<AutoStream<tokio::net::TcpStream>>();
is_async_read::<AutoStream<tokio_net::tcp::TcpStream>>();
#[cfg(feature = "connect")]
is_async_write::<AutoStream<tokio::net::TcpStream>>();
is_async_write::<AutoStream<tokio_net::tcp::TcpStream>>();

is_unpin::<WebSocketStream<tokio::net::TcpStream>>();
is_unpin::<WebSocketStream<tokio_net::tcp::TcpStream>>();
#[cfg(feature = "connect")]
is_unpin::<WebSocketStream<AutoStream<tokio::net::TcpStream>>>();
is_unpin::<WebSocketStream<AutoStream<tokio_net::tcp::TcpStream>>>();
}
}
2 changes: 1 addition & 1 deletion src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use pin_project::{pin_project, project};
use std::pin::Pin;
use std::task::{Context, Poll};

use tokio::io::{AsyncRead, AsyncWrite};
use tokio_io::{AsyncRead, AsyncWrite};

/// Stream, either plain TCP or TLS.
#[pin_project]
Expand Down
2 changes: 1 addition & 1 deletion tests/handshakes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::net::ToSocketAddrs;
use tokio::net::{TcpListener, TcpStream};
use tokio_net::tcp::{TcpListener, TcpStream};
use tokio_tungstenite::{accept_async, client_async};

#[tokio::test]
Expand Down

0 comments on commit b9b1c7d

Please sign in to comment.