fix abstraction

This commit is contained in:
2025-05-17 23:30:58 +01:00
parent d79c28c32f
commit 7c34c5385a
4 changed files with 97 additions and 57 deletions

41
Simulation/simulation.sh Normal file
View File

@@ -0,0 +1,41 @@
# Spin up seperate P2PRC instances
# Unset P2PRC
unset P2PRC
# Create P2PRC instances
# Parameters:
# 1. Number of nodes
P2PRC_instances() {
local rootPort
for (( counter=0; counter<$1; counter++ )); do
mkdir test-$counter/
cd test-$counter/
p2prc --dc
# change port no
NEW_PORT=$(shuf -i 2000-65000 -n 1)
if [ counter == 0 ]; then
rootPort = $NEW_PORT
fi
echo $rootPort
p2prc --arn --ip 0.0.0.0 --port $rootPort
sed -i.bak "s/\"ServerPort\": \"[0-9]*\"/\"ServerPort\": \"$NEW_PORT\"/" "./config.json"
p2prc --ls
cd ..
done
# remove all instances
rm -rf test-*
}
P2PRC_instances 2