mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-24 00:05:45 +00:00
fixed bug when closing
This commit is contained in:
+2
-1
@@ -110,6 +110,7 @@ impl Relay for RelayLocal {
|
||||
info!("Enabled UDP relay");
|
||||
}
|
||||
|
||||
Scheduler::run(num_cpus::get());
|
||||
// Scheduler::run(num_cpus::get());
|
||||
Scheduler::run(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,10 +212,13 @@ impl TcpRelayLocal {
|
||||
error!("{} relay from local to remote stream: {}", addr_cloned, err)
|
||||
}
|
||||
}
|
||||
let _ = encrypt_stream.get_ref().shutdown(Shutdown::Both);
|
||||
let _ = local_reader.get_ref().shutdown(Shutdown::Both);
|
||||
}
|
||||
}
|
||||
|
||||
let _ = encrypt_stream.get_ref().shutdown(Shutdown::Both);
|
||||
let _ = local_reader.get_ref().shutdown(Shutdown::Both);
|
||||
|
||||
debug!("Local to remote closed");
|
||||
});
|
||||
|
||||
Scheduler::spawn(move|| {
|
||||
@@ -254,6 +257,7 @@ impl TcpRelayLocal {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
match io::copy(&mut decrypt_stream, &mut local_writer) {
|
||||
Err(err) => {
|
||||
match err.kind() {
|
||||
@@ -264,11 +268,14 @@ impl TcpRelayLocal {
|
||||
error!("{} relay from local to remote stream: {}", addr, err)
|
||||
}
|
||||
}
|
||||
let _ = decrypt_stream.get_mut().shutdown(Shutdown::Both);
|
||||
let _ = local_writer.shutdown(Shutdown::Both);
|
||||
},
|
||||
Ok(..) => {},
|
||||
}
|
||||
|
||||
let _ = decrypt_stream.get_mut().shutdown(Shutdown::Both);
|
||||
let _ = local_writer.shutdown(Shutdown::Both);
|
||||
|
||||
debug!("Remote to local closed");
|
||||
});
|
||||
},
|
||||
socks5::Command::TcpBind => {
|
||||
|
||||
@@ -162,10 +162,11 @@ impl TcpRelayServer {
|
||||
error!("{} relay from local to remote stream: {}", addr_cloned, err)
|
||||
}
|
||||
}
|
||||
let _ = remote_stream_cloned.shutdown(Shutdown::Both);
|
||||
let _ = decrypt_stream.get_mut().get_mut().shutdown(Shutdown::Both);
|
||||
}
|
||||
}
|
||||
|
||||
let _ = remote_stream_cloned.shutdown(Shutdown::Both);
|
||||
let _ = decrypt_stream.get_mut().get_mut().shutdown(Shutdown::Both);
|
||||
});
|
||||
|
||||
Scheduler::spawn(move|| {
|
||||
@@ -201,10 +202,11 @@ impl TcpRelayServer {
|
||||
error!("{} relay from remote to local stream: {}", addr, err)
|
||||
}
|
||||
}
|
||||
let _ = encrypt_stream.get_mut().shutdown(Shutdown::Both);
|
||||
let _ = buffered_remote_stream.get_mut().shutdown(Shutdown::Both);
|
||||
}
|
||||
}
|
||||
|
||||
let _ = encrypt_stream.get_mut().shutdown(Shutdown::Both);
|
||||
let _ = buffered_remote_stream.get_mut().shutdown(Shutdown::Both);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user