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'`
|
DATE := `date +'%Y%m%d'`
|
||||||
TAG := moodle-$(USER)
|
TAG := moodle-$(USER)
|
||||||
|
PORT := $(shell expr `id -u` % 2000 + 12487)
|
||||||
|
PORT2 := $(shell expr $(PORT) + 1)
|
||||||
|
|
||||||
ifneq ($(tag),)
|
ifneq ($(tag),)
|
||||||
TAG := $(TAG)-$(tag)
|
TAG := $(TAG)-$(tag)
|
||||||
|
@ -25,7 +27,7 @@ vpath %.c $(SRC_DIR)
|
||||||
|
|
||||||
define make-goal
|
define make-goal
|
||||||
$1/%.o: %.c
|
$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
|
endef
|
||||||
|
|
||||||
.PHONY: all checkdirs clean
|
.PHONY: all checkdirs clean
|
||||||
|
|
|
@ -22,9 +22,12 @@ unsigned long get_now_time_usec();
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Private core functions, should not be used for implementing mictcp *
|
* Private core functions, should not be used for implementing mictcp *
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
#ifndef API_CS_Port
|
||||||
#define API_CS_Port 8524
|
#define API_CS_Port 8524
|
||||||
|
#endif
|
||||||
|
#ifndef API_SC_Port
|
||||||
#define API_SC_Port 8525
|
#define API_SC_Port 8525
|
||||||
|
#endif
|
||||||
#define API_HD_Size 15
|
#define API_HD_Size 15
|
||||||
|
|
||||||
typedef struct ip_payload
|
typedef struct ip_payload
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
puits=false
|
puits=false
|
||||||
sourc=false
|
sourc=false
|
||||||
protocol="tcp"
|
protocol="tcp"
|
||||||
|
port=`expr \`id -u\` % 3000 + 14578`
|
||||||
|
|
||||||
usage() { echo "Usage: $0 [[-p|-s] [-t (tcp|mictcp)]" 1>&2; exit 1; }
|
usage() { echo "Usage: $0 [[-p|-s] [-t (tcp|mictcp)]" 1>&2; exit 1; }
|
||||||
|
|
||||||
|
@ -35,11 +36,11 @@ fi
|
||||||
if [ "$puits" = true ]; then
|
if [ "$puits" = true ]; then
|
||||||
|
|
||||||
echo "Lancement du puits, protocole " $protocol
|
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
|
if [ "$protocol" = "mictcp" ]; then
|
||||||
cd build
|
cd build
|
||||||
./gateway -p -t $protocol 1234 &
|
./gateway -p -t $protocol $port &
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -48,7 +49,7 @@ if [ "$sourc" = true ]; then
|
||||||
|
|
||||||
echo "Lancement de la source, protocol " $protocol
|
echo "Lancement de la source, protocol " $protocol
|
||||||
cd build
|
cd build
|
||||||
./gateway -s -t $protocol 127.0.0.1 1234 &
|
./gateway -s -t $protocol 127.0.0.1 $port &
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue