mirror of
https://github.com/iv-org/inv_sig_helper.git
synced 2024-11-23 05:59:44 +00:00
Fixed the code, apparently there's nothing actually wrong with it
This commit is contained in:
parent
6bd9b67176
commit
fda0eeb863
@ -62,7 +62,7 @@ async fn main() {
|
|||||||
Ok(x) => x,
|
Ok(x) => x,
|
||||||
Err(x) => {
|
Err(x) => {
|
||||||
if x.kind() == std::io::ErrorKind::AddrInUse {
|
if x.kind() == std::io::ErrorKind::AddrInUse {
|
||||||
remove_file(socket_url);
|
remove_file(socket_url).await;
|
||||||
UnixListener::bind(socket_url).unwrap()
|
UnixListener::bind(socket_url).unwrap()
|
||||||
} else {
|
} else {
|
||||||
println!("Error occurred while trying to bind: {}", x);
|
println!("Error occurred while trying to bind: {}", x);
|
||||||
@ -89,12 +89,10 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn process_socket(state: Arc<GlobalState>, socket: UnixStream) {
|
async fn process_socket(state: Arc<GlobalState>, socket: UnixStream) {
|
||||||
let (rd, wr) = socket.into_split();
|
|
||||||
|
|
||||||
let decoder = OpcodeDecoder {};
|
let decoder = OpcodeDecoder {};
|
||||||
|
let str = Framed::new(socket, decoder);
|
||||||
|
|
||||||
let sink = FramedWrite::new(wr, decoder);
|
let (sink, mut stream) = str.split();
|
||||||
let mut stream = FramedRead::new(rd, decoder);
|
|
||||||
|
|
||||||
let arc_sink = Arc::new(Mutex::new(sink));
|
let arc_sink = Arc::new(Mutex::new(sink));
|
||||||
while let Some(opcode_res) = stream.next().await {
|
while let Some(opcode_res) = stream.next().await {
|
||||||
|
@ -34,6 +34,7 @@ impl Decoder for OpcodeDecoder {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src: &mut tokio_util::bytes::BytesMut,
|
src: &mut tokio_util::bytes::BytesMut,
|
||||||
) -> Result<Option<Self::Item>, Self::Error> {
|
) -> Result<Option<Self::Item>, Self::Error> {
|
||||||
|
println!("Decoder length: {}", src.len());
|
||||||
if 5 > src.len() {
|
if 5 > src.len() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user