From 1ebde0f0ed89392be2cfd95a6f04ce87b050703a Mon Sep 17 00:00:00 2001 From: Mitch161 Date: Fri, 17 Jul 2020 20:23:38 +0100 Subject: [PATCH] added check for success return message --- src/server/client/client_profile.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/server/client/client_profile.rs b/src/server/client/client_profile.rs index f9646c4..2c4d869 100644 --- a/src/server/client/client_profile.rs +++ b/src/server/client/client_profile.rs @@ -77,11 +77,7 @@ impl<'a> Client<'a> { match command { Commands::Info(Some(params)) => { - self.get_stream().write_all(a.to_string().as_bytes()); - /* why not do this? - * - * self.transmit_data(a.to_string().as_str()); - */ + self.transmit_data(a.to_string().as_str()); }, Commands::Disconnect(None) => { @@ -89,10 +85,17 @@ impl<'a> Client<'a> { Commands::ClientRemove(Some(params)) => {}, Commands::Client(Some(params)) => { self.transmit_data(a.to_string().as_str()); - todo!() - /* - * a success message needs to be read and confirmed - */ + + let command = Commands::from(&buffer); + match command{ + Commands::Success(None) => { + println!("sucess confirmed"); + }, + _ => { + let error = Commands::Error(None); + self.transmit_data(error.to_string().as_str()); + }, + } }, Commands::Success(data) => {}, _ => {},