Change server address, make write to buf async

This commit is contained in:
Bastian Gruber 2023-04-24 22:57:57 +02:00
parent a245bc8200
commit 7795854613
No known key found for this signature in database
GPG key ID: BE9F8C772B188CBF
2 changed files with 2 additions and 2 deletions

View file

@ -7,7 +7,7 @@ use tokio::signal;
pub async fn main() -> problem_02::Result<()> {
tracing_subscriber::fmt::try_init()?;
let listener = TcpListener::bind(&format!("127.0.0.1:{}", DEFAULT_PORT)).await?;
let listener = TcpListener::bind(&format!("0.0.0.0:{}", DEFAULT_PORT)).await?;
server::run(listener, signal::ctrl_c()).await?;

View file

@ -64,7 +64,7 @@ impl Connection {
pub async fn write_frame(&mut self, frame: &Frame) -> crate::Result<()> {
debug!(?frame);
if let Frame::Response(mean) = frame {
let _ = self.stream.write(&[mean.to_ne_bytes()[0]]);
let _ = self.stream.write(&[mean.to_ne_bytes()[0]]).await?;
return Ok(());
}