summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/Cargo.toml2
-rw-r--r--client/src/client/run.rs25
2 files changed, 23 insertions, 4 deletions
diff --git a/client/Cargo.toml b/client/Cargo.toml
index 9791b14..e8c57ac 100644
--- a/client/Cargo.toml
+++ b/client/Cargo.toml
@@ -11,7 +11,7 @@ repository.workspace = true
[dependencies]
bowshock = { path = "../core" }
-bzipper = { version = "0.6.0", features = ["alloc"]}
+bzipper = { version = "0.6.2", features = ["alloc"]}
[lints]
workspace = true
diff --git a/client/src/client/run.rs b/client/src/client/run.rs
index d955cea..88cc056 100644
--- a/client/src/client/run.rs
+++ b/client/src/client/run.rs
@@ -2,7 +2,7 @@
use crate::{Client, ServerConnection};
-use bowshock::net::{DEFAULT_SERVER_PORT, Request};
+use bowshock::net::{Request, Response, DEFAULT_SERVER_PORT};
use bzipper::FixedString;
impl Client {
@@ -12,8 +12,27 @@ impl Client {
let mut connection = ServerConnection::new(server_addr);
- let join_request = Request::PlayerJoin { username: FixedString::try_from("delta").unwrap() };
- connection.send_request(&join_request);
+ let mut request = Request::Ping;
+ connection.send_request(&request);
+
+ let mut response = connection.recieve_response();
+
+ eprintln!("got response {response:?}");
+
+ request = Request::Join { username: FixedString::try_from("delta").unwrap() };
+ connection.send_request(&request);
+
+ response = connection.recieve_response();
+
+ eprintln!("got response {response:?}");
+
+ let Response::JoinAccepted { token } = response else {
+ eprintln!("expected approved join :(");
+ return Err(0x1);
+ };
+
+ request = Request::Quit { token };
+ connection.send_request(&request);
Ok(())
}