diff --git a/server/texture-sync-server/src/protocol/implementation/listen_forever.rs b/server/texture-sync-server/src/protocol/implementation/listen_forever.rs index b60c792..7177cb1 100644 --- a/server/texture-sync-server/src/protocol/implementation/listen_forever.rs +++ b/server/texture-sync-server/src/protocol/implementation/listen_forever.rs @@ -7,8 +7,8 @@ use std::time::Duration; use super::*; pub fn listen_forever(handler: H, config: &ProtocolConfig) -> io::Result<()> - where - H: 'static + ProtocolHandler + Sized, +where + H: 'static + ProtocolHandler + Sized, { let listener = TcpListener::bind((config.listen_addr.as_str(), config.port))?; @@ -29,8 +29,8 @@ pub fn listen_forever(handler: H, config: &ProtocolConfig) -> io::Result<()> } fn client_loop(connection: TcpStream, mut handler: H) -> io::Result<()> - where - H: 'static + ProtocolHandler + Sized, +where + H: 'static + ProtocolHandler + Sized, { let mut connection = Connection::from_tcp(connection)?; 'outer: loop { @@ -78,9 +78,9 @@ fn client_loop(connection: TcpStream, mut handler: H) -> io::Result<()> } Package::Command(Command::GetTexturePreview { - texture_hash, - desired_format, - }) => { + texture_hash, + desired_format, + }) => { connection.send(&Package::from( handler.get_texture_preview(texture_hash, desired_format), ))?; @@ -101,18 +101,18 @@ fn client_loop(connection: TcpStream, mut handler: H) -> io::Result<()> match pkg { Package::Binary(data) => { match handler.replace_texture(old.clone(), new.clone(), Some(data)) - { - Ok(ReplaceTextureStatus::Ok) => { - connection.send(&Package::Json(JsonValue::True))?; - } - Ok(ReplaceTextureStatus::NeedTextureData(hash)) => { - panic!("Contract Violation: handler must not return NeedTextureData \ - when data is given."); - } - Err(err) => { - connection.send(&Package::from(err))?; - } + { + Ok(ReplaceTextureStatus::Ok) => { + connection.send(&Package::Json(JsonValue::True))?; } + Ok(ReplaceTextureStatus::NeedTextureData(hash)) => { + panic!("Contract Violation: handler must not return NeedTextureData \ + when data is given."); + } + Err(err) => { + connection.send(&Package::from(err))?; + } + } } Package::Error(_, _) => { // Just close the connection. diff --git a/server/texture-sync-server/src/protocol/implementation/package.rs b/server/texture-sync-server/src/protocol/implementation/package.rs index 5ad6a83..ecc1154 100644 --- a/server/texture-sync-server/src/protocol/implementation/package.rs +++ b/server/texture-sync-server/src/protocol/implementation/package.rs @@ -93,4 +93,4 @@ impl From>> for Package { Err(err) => Package::from(err), } } -} \ No newline at end of file +}