Skip to content

Commit

Permalink
Update to latest tokio version 1.16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-belcher committed Feb 9, 2022
1 parent 731d738 commit 73145d8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitcoin-wallet = "1.1.0"
bitcoin = "0.25"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "0.3", features = ["full"] }
tokio = { version = "1.16.1", features = ["full"] }
log = "^0.4"
env_logger = "0.7"
futures = "0.3"
Expand Down
6 changes: 3 additions & 3 deletions src/maker_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ use std::net::{Ipv4Addr, SocketAddr};
use std::sync::{Arc, RwLock};
use std::time::{Duration, Instant};

use tokio::io::BufReader;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::tcp::WriteHalf;
use tokio::net::TcpListener;
use tokio::prelude::*;
use tokio::select;
use tokio::sync::mpsc;
use tokio::time::sleep;
Expand Down Expand Up @@ -260,7 +259,8 @@ async fn send_message(
socket_writer: &mut WriteHalf<'_>,
first_message: &MakerToTakerMessage,
) -> Result<(), Error> {
let mut message_bytes = serde_json::to_vec(first_message).map_err(|e| io::Error::from(e))?;
let mut message_bytes =
serde_json::to_vec(first_message).map_err(|e| std::io::Error::from(e))?;
message_bytes.push(b'\n');
socket_writer.write_all(&message_bytes).await?;
Ok(())
Expand Down
3 changes: 1 addition & 2 deletions src/offerbook_sync.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use tokio::io::BufReader;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::TcpStream;
use tokio::prelude::*;
use tokio::sync::mpsc;

use crate::messages::{GiveOffer, MakerToTakerMessage, Offer, TakerHello, TakerToMakerMessage};
Expand Down
7 changes: 3 additions & 4 deletions src/taker_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ use std::io::ErrorKind;
use std::iter::once;
use std::time::Duration;

use tokio::io::BufReader;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::tcp::{ReadHalf, WriteHalf};
use tokio::net::TcpStream;
use tokio::prelude::*;
use tokio::time::sleep;

use bitcoin::consensus::encode::deserialize;
Expand Down Expand Up @@ -406,7 +405,7 @@ async fn send_message(
message: TakerToMakerMessage,
) -> Result<(), Error> {
log::debug!("==> {:#?}", message);
let mut result_bytes = serde_json::to_vec(&message).map_err(|e| io::Error::from(e))?;
let mut result_bytes = serde_json::to_vec(&message).map_err(|e| std::io::Error::from(e))?;
result_bytes.push(b'\n');
socket_writer.write_all(&result_bytes).await?;
Ok(())
Expand All @@ -416,7 +415,7 @@ async fn read_message(reader: &mut BufReader<ReadHalf<'_>>) -> Result<MakerToTak
let mut line = String::new();
let n = reader.read_line(&mut line).await?;
if n == 0 {
return Err(Error::Network(Box::new(io::Error::new(
return Err(Error::Network(Box::new(std::io::Error::new(
ErrorKind::ConnectionReset,
"EOF",
))));
Expand Down
3 changes: 1 addition & 2 deletions src/watchtower_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use tokio::io::BufReader;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::TcpStream;
use tokio::prelude::*;

use crate::error::Error;
use crate::watchtower_protocol::{
Expand Down
5 changes: 2 additions & 3 deletions src/watchtower_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ use std::net::Ipv4Addr;
use std::sync::{Arc, RwLock};
use std::time::Duration;

use tokio::io::BufReader;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::tcp::WriteHalf;
use tokio::net::TcpListener;
use tokio::prelude::*;
use tokio::select;
use tokio::sync::mpsc;
use tokio::time::sleep;
Expand Down Expand Up @@ -265,7 +264,7 @@ async fn send_message(
socket_writer: &mut WriteHalf<'_>,
message: &WatchtowerToMakerMessage,
) -> Result<(), Error> {
let mut message_bytes = serde_json::to_vec(message).map_err(|e| io::Error::from(e))?;
let mut message_bytes = serde_json::to_vec(message).map_err(|e| std::io::Error::from(e))?;
message_bytes.push(b'\n');
socket_writer.write_all(&message_bytes).await?;
Ok(())
Expand Down

0 comments on commit 73145d8

Please sign in to comment.