mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-26 07:59:28 -05:00
Remove wrapping if ReadOneError
when unnecessary
This commit is contained in:
parent
2929a8f101
commit
2073e88683
@ -2,7 +2,7 @@ use crate::protocol::{alice, alice::TransferProof, bob, bob::EncryptedSignature}
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use libp2p::{
|
use libp2p::{
|
||||||
core::upgrade,
|
core::{upgrade, upgrade::ReadOneError},
|
||||||
request_response::{ProtocolName, RequestResponseCodec},
|
request_response::{ProtocolName, RequestResponseCodec},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -213,9 +213,10 @@ where
|
|||||||
T: AsyncRead + Unpin + Send,
|
T: AsyncRead + Unpin + Send,
|
||||||
{
|
{
|
||||||
debug!("enter read_request");
|
debug!("enter read_request");
|
||||||
let message = upgrade::read_one(io, BUF_SIZE)
|
let message = upgrade::read_one(io, BUF_SIZE).await.map_err(|e| match e {
|
||||||
.await
|
ReadOneError::Io(err) => err,
|
||||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
e => io::Error::new(io::ErrorKind::Other, e),
|
||||||
|
})?;
|
||||||
let mut de = serde_cbor::Deserializer::from_slice(&message);
|
let mut de = serde_cbor::Deserializer::from_slice(&message);
|
||||||
let msg = Request::deserialize(&mut de).map_err(|e| {
|
let msg = Request::deserialize(&mut de).map_err(|e| {
|
||||||
tracing::debug!("serde read_request error: {:?}", e);
|
tracing::debug!("serde read_request error: {:?}", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user