fix some things

This commit is contained in:
nora 2022-02-21 21:09:04 +01:00
parent b67c722c19
commit 6f5fef2f23
9 changed files with 55 additions and 55 deletions

View file

@ -16,7 +16,7 @@ rand = "0.8.4"
regex = "1.5.4"
smallvec = { version = "1.8.0", features = ["union"] }
thiserror = "1.0.30"
tokio = { version = "1.16.1", features = ["full", "tracing"] }
tokio = { version = "1.16.1", features = ["full"] }
tracing = "0.1.30"
uuid = "0.8.2"

View file

@ -252,7 +252,7 @@ impl Connection {
}
}
async fn dispatch_method(&mut self, frame: Frame) -> Result<()> {
async fn dispatch_method(&mut self, frame: Frame) -> Result<WaitForBodyStatus> {
let method = methods::parse_method(&frame.payload)?;
debug!(?method, "Received method");
@ -373,15 +373,14 @@ impl Connection {
let version = &read_header_buf[5..8];
self.stream
.write_all(OWN_PROTOCOL_HEADER)
.await
.context("write protocol header")?;
if &read_header_buf[0..5] == b"AMQP\0" && version == SUPPORTED_PROTOCOL_VERSION {
debug!(?version, "Version negotiation successful");
Ok(())
} else {
self.stream
.write_all(OWN_PROTOCOL_HEADER)
.await
.context("write protocol header")?;
debug!(?version, expected_version = ?SUPPORTED_PROTOCOL_VERSION, "Version negotiation failed, unsupported version");
Err(ProtocolError::CloseNow.into())
}

View file

@ -38,8 +38,6 @@ pub async fn do_thing_i_guess(global_data: GlobalData) -> Result<()> {
let connection = Connection::new(id, stream, connection_handle, global_data.clone());
tokio::task::Builder::new()
.name(&format!("connection {id}"))
.spawn(connection.start_connection_processing().instrument(span));
tokio::spawn(connection.start_connection_processing().instrument(span));
}
}