Changes to use random port numbers (depend on user's uid) rather
than a static port. Allows all students to use the same machine (for Covid-19 mitigation)
This commit is contained in:
parent
4e12819c36
commit
f643d39168
3 changed files with 13 additions and 7 deletions
4
Makefile
4
Makefile
|
@ -1,5 +1,7 @@
|
|||
DATE := `date +'%Y%m%d'`
|
||||
TAG := moodle-$(USER)
|
||||
PORT := $(shell expr `id -u` % 2000 + 12487)
|
||||
PORT2 := $(shell expr $(PORT) + 1)
|
||||
|
||||
ifneq ($(tag),)
|
||||
TAG := $(TAG)-$(tag)
|
||||
|
@ -25,7 +27,7 @@ vpath %.c $(SRC_DIR)
|
|||
|
||||
define make-goal
|
||||
$1/%.o: %.c
|
||||
$(CC) -std=gnu99 -Wall -g -I $(INCLUDES) -c $$< -o $$@
|
||||
$(CC) -DAPI_CS_Port=$(PORT) -DAPI_SC_Port=$(PORT2) -std=gnu99 -Wall -g -I $(INCLUDES) -c $$< -o $$@
|
||||
endef
|
||||
|
||||
.PHONY: all checkdirs clean
|
||||
|
|
|
@ -22,9 +22,12 @@ unsigned long get_now_time_usec();
|
|||
/**********************************************************************
|
||||
* Private core functions, should not be used for implementing mictcp *
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef API_CS_Port
|
||||
#define API_CS_Port 8524
|
||||
#endif
|
||||
#ifndef API_SC_Port
|
||||
#define API_SC_Port 8525
|
||||
#endif
|
||||
#define API_HD_Size 15
|
||||
|
||||
typedef struct ip_payload
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
puits=false
|
||||
sourc=false
|
||||
protocol="tcp"
|
||||
port=`expr \`id -u\` % 3000 + 14578`
|
||||
|
||||
usage() { echo "Usage: $0 [[-p|-s] [-t (tcp|mictcp)]" 1>&2; exit 1; }
|
||||
|
||||
|
@ -35,11 +36,11 @@ fi
|
|||
if [ "$puits" = true ]; then
|
||||
|
||||
echo "Lancement du puits, protocole " $protocol
|
||||
cvlc rtp://127.0.0.1:1234 > /dev/null 2>&1 &
|
||||
cvlc rtp://127.0.0.1:$port > /dev/null 2>&1 &
|
||||
|
||||
if [ "$protocol" = "mictcp" ]; then
|
||||
cd build
|
||||
./gateway -p -t $protocol 1234 &
|
||||
./gateway -p -t $protocol $port &
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
|
@ -48,7 +49,7 @@ if [ "$sourc" = true ]; then
|
|||
|
||||
echo "Lancement de la source, protocol " $protocol
|
||||
cd build
|
||||
./gateway -s -t $protocol 127.0.0.1 1234 &
|
||||
./gateway -s -t $protocol 127.0.0.1 $port &
|
||||
cd ..
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue