|
|
@ -4,6 +4,7 @@ use crate::{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use futures::{SinkExt, StreamExt};
|
|
|
|
use futures::{SinkExt, StreamExt};
|
|
|
|
|
|
|
|
use log::*;
|
|
|
|
use serde::{de::DeserializeOwned, Serialize};
|
|
|
|
use serde::{de::DeserializeOwned, Serialize};
|
|
|
|
use std::io;
|
|
|
|
use std::io;
|
|
|
|
use tokio_util::codec::{Framed, FramedRead, FramedWrite};
|
|
|
|
use tokio_util::codec::{Framed, FramedRead, FramedWrite};
|
|
|
@ -112,8 +113,13 @@ where
|
|
|
|
let data = data?;
|
|
|
|
let data = data?;
|
|
|
|
|
|
|
|
|
|
|
|
// Deserialize byte stream into our expected type
|
|
|
|
// Deserialize byte stream into our expected type
|
|
|
|
let data = utils::deserialize_from_slice(&data)?;
|
|
|
|
match utils::deserialize_from_slice(&data) {
|
|
|
|
Ok(Some(data))
|
|
|
|
Ok(data) => Ok(Some(data)),
|
|
|
|
|
|
|
|
Err(x) => {
|
|
|
|
|
|
|
|
error!("Invalid data: {}", String::from_utf8_lossy(&data));
|
|
|
|
|
|
|
|
Err(x)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Ok(None)
|
|
|
|
Ok(None)
|
|
|
|
}
|
|
|
|
}
|
|
|
|