Compare commits
No commits in common. "e403d93dc28a9fc541195996522e024a5270fda5" and "c70527ded5399a411b221e6c4f4aca864c63a67c" have entirely different histories.
e403d93dc2
...
c70527ded5
2 changed files with 1 additions and 18 deletions
15
src/main.rs
15
src/main.rs
|
|
@ -115,18 +115,8 @@ async fn process_connection<T: MinecraftServerHandle>(
|
|||
packets::ProtocolState::Login => {
|
||||
// This block of packet parsing is needed here, so the span with the
|
||||
// username is correctly propagated due to the async nature of things
|
||||
let span = tracing::span!(
|
||||
tracing::Level::INFO,
|
||||
"login_username_extract",
|
||||
server_addr = handshake.get_server_address(),
|
||||
server_port = handshake.server_port.get_value()
|
||||
);
|
||||
|
||||
let packet = Packet::parse(&mut client_stream)
|
||||
.instrument(span.clone())
|
||||
.await?;
|
||||
let packet = Packet::parse(&mut client_stream).await?;
|
||||
let login_packet = packets::serverbound::login::LoginStart::parse(packet)
|
||||
.instrument(span.clone())
|
||||
.await
|
||||
.ok_or("Failed to parse login start packet".to_string())?;
|
||||
handle_login(&mut client_stream, &handshake, login_packet, api).await?
|
||||
|
|
@ -250,9 +240,6 @@ async fn handle_login<T: MinecraftServerHandle>(
|
|||
tracing::debug!(msg = "server status", status = ?status);
|
||||
match status {
|
||||
ServerDeploymentStatus::Connectable(mut server_stream) => {
|
||||
api.start_watch(server.clone(), Duration::from_secs(600))
|
||||
.await?;
|
||||
|
||||
// referenced from:
|
||||
// https://github.com/hanyu-dev/tokio-splice2/blob/fc47199fffde8946b0acf867d1fa0b2222267a34/examples/proxy.rs
|
||||
let io_sl2sr = tokio_splice2::context::SpliceIoCtx::prepare()
|
||||
|
|
|
|||
|
|
@ -123,10 +123,6 @@ pub trait MinecraftServerHandle: Clone {
|
|||
|
||||
pub trait MinecraftAPI<T> {
|
||||
async fn query_server(&self, addr: &str, port: &str) -> Result<T, OpaqueError>;
|
||||
|
||||
// TODO: move the implementation to here, but
|
||||
/// This should be callable even if there is already a watcher,
|
||||
/// and it should handle the collision itself while returning OK().
|
||||
async fn start_watch(
|
||||
self,
|
||||
server: impl MinecraftServerHandle,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue