From 3359396220136adea4732403e52b15fe1a68152c Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 13 Feb 2022 11:39:27 +0100 Subject: [PATCH] Fix problems with release build --- .gitignore | 1 + snapshot.sh | 2 +- src/client/client.c | 7 ++++--- src/client/client_auth.c | 2 +- src/client/client_auth.h | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 652ffa0..00abea6 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ _deps Dragonblocks DragonblocksServer DragonblocksAlpha-*.zip +DragonblocksAlpha # Data client.conf diff --git a/snapshot.sh b/snapshot.sh index c0a7976..f03ceed 100755 --- a/snapshot.sh +++ b/snapshot.sh @@ -4,7 +4,7 @@ cp -r * .build/ cd .build/ mkdir build cd build -if ! (cmake -B . -S ../src -DCMAKE_BUILD_TYPE=Release -DRESSOURCE_PATH="" && make clean && make -j$(nproc)); then +if ! (cmake -B . -S ../src -DCMAKE_BUILD_TYPE=Release -DRESSOURCE_PATH="\"\"" && make clean && make -j$(nproc)); then cd ../.. rm -rf .build exit 1 diff --git a/src/client/client.c b/src/client/client.c index 88bcded..80af198 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -16,12 +16,12 @@ DragonnetPeer *client; -static bool finished = false; +static volatile bool finished = false; static bool on_recv(unused DragonnetPeer *peer, DragonnetTypeId type, unused void *pkt) { while (client_auth.state == AUTH_INIT) - ; + sched_yield(); return (client_auth.state == AUTH_WAIT) == (type == DRAGONNET_TYPE_ToClientAuth); } @@ -29,8 +29,9 @@ static bool on_recv(unused DragonnetPeer *peer, DragonnetTypeId type, unused voi static void on_disconnect(unused DragonnetPeer *peer) { interrupted = true; + while (! finished) - ; + sched_yield(); } static void on_ToClientAuth(unused DragonnetPeer *peer, ToClientAuth *pkt) diff --git a/src/client/client_auth.c b/src/client/client_auth.c index d78d992..1e76d31 100644 --- a/src/client/client_auth.c +++ b/src/client/client_auth.c @@ -6,7 +6,7 @@ #include "signal_handlers.h" #include "types.h" -struct ClientAuth client_auth; +volatile struct ClientAuth client_auth; static bool name_prompt() { diff --git a/src/client/client_auth.h b/src/client/client_auth.h index ba14942..4d30ca0 100644 --- a/src/client/client_auth.h +++ b/src/client/client_auth.h @@ -8,7 +8,7 @@ typedef enum AUTH_SUCCESS, } ClientAuthState; -extern struct ClientAuth +extern volatile struct ClientAuth { char *name; ClientAuthState state; -- 2.44.0