Replace deprecated tokio_io::codec to tokio_codec
This commit is contained in:
parent
1cf7744156
commit
8ffac6bef0
5 changed files with 11 additions and 6 deletions
|
@ -35,6 +35,7 @@ serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_json = { version = "1.0", optional = true }
|
serde_json = { version = "1.0", optional = true }
|
||||||
serde_yaml = { version = "0.7", optional = true }
|
serde_yaml = { version = "0.7", optional = true }
|
||||||
|
tokio-codec = "0.1"
|
||||||
tokio-core = "0.1"
|
tokio-core = "0.1"
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1"
|
||||||
tokio-mockstream = "1.1"
|
tokio-mockstream = "1.1"
|
||||||
|
|
|
@ -7,9 +7,9 @@ use encoding::EncoderTrap;
|
||||||
use encoding::label::encoding_from_whatwg_label;
|
use encoding::label::encoding_from_whatwg_label;
|
||||||
use futures::{Async, Poll, Future, Sink, StartSend, Stream};
|
use futures::{Async, Poll, Future, Sink, StartSend, Stream};
|
||||||
use native_tls::{Certificate, TlsConnector, Pkcs12};
|
use native_tls::{Certificate, TlsConnector, Pkcs12};
|
||||||
|
use tokio_codec::Decoder;
|
||||||
use tokio_core::reactor::Handle;
|
use tokio_core::reactor::Handle;
|
||||||
use tokio_core::net::{TcpStream, TcpStreamNew};
|
use tokio_core::net::{TcpStream, TcpStreamNew};
|
||||||
use tokio_io::AsyncRead;
|
|
||||||
use tokio_mockstream::MockStream;
|
use tokio_mockstream::MockStream;
|
||||||
use tokio_tls::{TlsConnectorExt, TlsStream};
|
use tokio_tls::{TlsConnectorExt, TlsStream};
|
||||||
|
|
||||||
|
@ -81,13 +81,15 @@ impl<'a> Future for ConnectionFuture<'a> {
|
||||||
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
||||||
match *self {
|
match *self {
|
||||||
ConnectionFuture::Unsecured(config, ref mut inner) => {
|
ConnectionFuture::Unsecured(config, ref mut inner) => {
|
||||||
let framed = try_ready!(inner.poll()).framed(IrcCodec::new(config.encoding())?);
|
let stream = try_ready!(inner.poll());
|
||||||
|
let framed = IrcCodec::new(config.encoding())?.framed(stream);
|
||||||
let transport = IrcTransport::new(config, framed);
|
let transport = IrcTransport::new(config, framed);
|
||||||
|
|
||||||
Ok(Async::Ready(Connection::Unsecured(transport)))
|
Ok(Async::Ready(Connection::Unsecured(transport)))
|
||||||
}
|
}
|
||||||
ConnectionFuture::Secured(config, ref mut inner) => {
|
ConnectionFuture::Secured(config, ref mut inner) => {
|
||||||
let framed = try_ready!(inner.poll()).framed(IrcCodec::new(config.encoding())?);
|
let stream = try_ready!(inner.poll());
|
||||||
|
let framed = IrcCodec::new(config.encoding())?.framed(stream);
|
||||||
let transport = IrcTransport::new(config, framed);
|
let transport = IrcTransport::new(config, framed);
|
||||||
|
|
||||||
Ok(Async::Ready(Connection::Secured(transport)))
|
Ok(Async::Ready(Connection::Secured(transport)))
|
||||||
|
@ -109,7 +111,8 @@ impl<'a> Future for ConnectionFuture<'a> {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
let framed = MockStream::new(&initial?).framed(IrcCodec::new(config.encoding())?);
|
let stream = MockStream::new(&initial?);
|
||||||
|
let framed = IrcCodec::new(config.encoding())?.framed(stream);
|
||||||
let transport = IrcTransport::new(config, framed);
|
let transport = IrcTransport::new(config, framed);
|
||||||
|
|
||||||
Ok(Async::Ready(Connection::Mock(Logged::wrap(transport))))
|
Ok(Async::Ready(Connection::Mock(Logged::wrap(transport))))
|
||||||
|
|
|
@ -6,8 +6,8 @@ use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use futures::{Async, AsyncSink, Future, Poll, Sink, StartSend, Stream};
|
use futures::{Async, AsyncSink, Future, Poll, Sink, StartSend, Stream};
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
|
use tokio_codec::Framed;
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
use tokio_io::codec::Framed;
|
|
||||||
use tokio_timer;
|
use tokio_timer;
|
||||||
use tokio_timer::{Interval, Sleep, Timer};
|
use tokio_timer::{Interval, Sleep, Timer};
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ extern crate serde_derive;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
#[cfg(feature = "yaml")]
|
#[cfg(feature = "yaml")]
|
||||||
extern crate serde_yaml;
|
extern crate serde_yaml;
|
||||||
|
extern crate tokio_codec;
|
||||||
extern crate tokio_core;
|
extern crate tokio_core;
|
||||||
extern crate tokio_io;
|
extern crate tokio_io;
|
||||||
extern crate tokio_mockstream;
|
extern crate tokio_mockstream;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Implementation of IRC codec for Tokio.
|
//! Implementation of IRC codec for Tokio.
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use tokio_io::codec::{Decoder, Encoder};
|
use tokio_codec::{Decoder, Encoder};
|
||||||
|
|
||||||
use error;
|
use error;
|
||||||
use proto::line::LineCodec;
|
use proto::line::LineCodec;
|
||||||
|
|
Loading…
Reference in a new issue