From 821a4b9c50b4fc2aa9468d23d9a1e5593ba1a778 Mon Sep 17 00:00:00 2001 From: sdemeesterde <samuel.demeester@student.uclouvain.be> Date: Thu, 7 Apr 2022 21:47:30 +0200 Subject: [PATCH] cleaner --- src/sender_utils.h | 14 ++++++++------ tests/advanced_test.sh | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/sender_utils.h b/src/sender_utils.h index 17b11f8..035aa0c 100644 --- a/src/sender_utils.h +++ b/src/sender_utils.h @@ -24,10 +24,12 @@ #define OUT_OFF_WINDOW 255 // It is used to identify what kind of pkt was sent lately -#define RANDOM_PKT 0 -#define LAST_DATA_PKT 1 -#define CLOSING_PKT 2 -#define LAST_FEC 3 +typedef enum { + RANDOM_PKT = 0, + LAST_DATA_PKT = 1, + CLOSING_PKT = 2, + LAST_FEC = 3 +} last_sended_pkt_t; /** @@ -42,9 +44,9 @@ typedef struct state { uint8_t tail; // place oldest element insert in the buffer | the start and end of the sender window (of the sended pkt) uint8_t next_seqnum; uint8_t map_seqnum_to_buffer_place[SEQNUM_RANGE]; // Default value is: OUT_OFF_WINDOW - uint8_t last_pkt_sent; // Can either be: RANDOM_PKT, LAST_DATA_PKT, CLOSING_PKT or LAST_FEC + last_sended_pkt_t last_pkt_sent; // Can either be: RANDOM_PKT, LAST_DATA_PKT, CLOSING_PKT or LAST_FEC pkt_t *FEC; // The pkt FEC in construction - uint8_t FEC_nbr; // The number of PTYPE_DATA stacked on the FEC + uint8_t FEC_nbr; // The number of PTYPE_DATA stacked on FEC } sender_state_t; diff --git a/tests/advanced_test.sh b/tests/advanced_test.sh index 297f497..72fb0aa 100755 --- a/tests/advanced_test.sh +++ b/tests/advanced_test.sh @@ -47,7 +47,7 @@ cleanup() trap cleanup SIGINT # Kill the background procces in case of ^-C # We start the transfer -if ! valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/adv_valgrind_${BSN_PRE}_receiver.log \ +if ! valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/adv_valgrind_${BSN_PRE}_sender.log \ ./sender -f ${FILENAME} ::1 $port2 2> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_sender.log ; then echo "Crash du sender!" cat ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_sender.log -- GitLab