about summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-03-23 20:34:26 +0100
committerChristian Krinitsin <mail@krinitsin.com>2025-03-23 20:34:26 +0100
commit876b2f8e699c1b24ae5e4f98a4affe9fa1a8650f (patch)
treee43eace54529dbc83994bc1404dd51ed08a25c42 /src/common
parent36dabafe242e8dc290ff76885c43c773b6d20b28 (diff)
downloadBT-Programming-Assignment-876b2f8e699c1b24ae5e4f98a4affe9fa1a8650f.tar.gz
BT-Programming-Assignment-876b2f8e699c1b24ae5e4f98a4affe9fa1a8650f.zip
add a request status, so that multiple clients cannot overwrite requests from other clients
Diffstat (limited to 'src/common')
-rw-r--r--src/common/shared_memory.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/shared_memory.h b/src/common/shared_memory.h
index fe101ea..1798ad1 100644
--- a/src/common/shared_memory.h
+++ b/src/common/shared_memory.h
@@ -14,11 +14,14 @@
  */
 enum Operations { INSERT, DELETE, GET, PRINT };
 
+enum Status { FREE, SENT, PROCESSED};
+
 /**
  * @brief One request constists out of the operation, the arguments and the response.
  */
 struct Request {
     Operations type;
+    Status status = FREE;
     char key[MAX_KEY_SIZE];
     char value[MAX_VALUE_SIZE];
     char response[MAX_VALUE_SIZE];
@@ -38,7 +41,6 @@ struct SharedMemory {
 
     int tail;
     int head;
-    bool full;
 };
 
 /**