mirror of
https://github.com/iv-org/inv_sig_helper.git
synced 2024-11-22 21:49:42 +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,
|
||||
Err(x) => {
|
||||
if x.kind() == std::io::ErrorKind::AddrInUse {
|
||||
remove_file(socket_url);
|
||||
remove_file(socket_url).await;
|
||||
UnixListener::bind(socket_url).unwrap()
|
||||
} else {
|
||||
println!("Error occurred while trying to bind: {}", x);
|
||||
@ -89,12 +89,10 @@ async fn main() {
|
||||
}
|
||||
|
||||
async fn process_socket(state: Arc<GlobalState>, socket: UnixStream) {
|
||||
let (rd, wr) = socket.into_split();
|
||||
|
||||
let decoder = OpcodeDecoder {};
|
||||
let str = Framed::new(socket, decoder);
|
||||
|
||||
let sink = FramedWrite::new(wr, decoder);
|
||||
let mut stream = FramedRead::new(rd, decoder);
|
||||
let (sink, mut stream) = str.split();
|
||||
|
||||
let arc_sink = Arc::new(Mutex::new(sink));
|
||||
while let Some(opcode_res) = stream.next().await {
|
||||
|
@ -34,6 +34,7 @@ impl Decoder for OpcodeDecoder {
|
||||
&mut self,
|
||||
src: &mut tokio_util::bytes::BytesMut,
|
||||
) -> Result<Option<Self::Item>, Self::Error> {
|
||||
println!("Decoder length: {}", src.len());
|
||||
if 5 > src.len() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user