added working version of simulator

This commit is contained in:
2025-05-30 17:09:36 +01:00
parent a46ec3575c
commit 02e58493f5
2 changed files with 20 additions and 18 deletions

View File

@@ -57,6 +57,7 @@ Start_all_instances() {
# Start P2PRC as background process
p2prc -s &
pids+=($!)
sleep 3
cd ..
done
}
@@ -100,20 +101,20 @@ unset P2PRC
# Run with 2 nodes
P2PRC_instances 3
# Start instances
## Start instances
Start_all_instances 3
#
## Delay for instances to run
# Delay for instances to run
sleep 6
# update all instances ip table
#Update_All_IP_Tables 3
# List ip tables of nodes started
#
## update all instances ip table
##Update_All_IP_Tables 3
#
## List ip tables of nodes started
IP_Tables_after_Started 3
# Remove test files created
#
## Remove test files created
Remove_all_test_files
# Kill all instances
#
## Kill all instances
Kill_all_instances

View File

@@ -118,7 +118,7 @@ func UpdateIpTableListClient() error {
Exists := false
// If the address is local then add to the local list
if currentIPV4 == Addresses.IpAddress[j].Ipv4 && Addresses.IpAddress[j].ServerPort == Config.ServerPort {
if (currentIPV4 == Addresses.IpAddress[j].Ipv4 && !Config.Test) && Addresses.IpAddress[j].ServerPort == Config.ServerPort {
Exists = true
}
@@ -136,11 +136,12 @@ func UpdateIpTableListClient() error {
}
w.Add(1)
if Addresses.IpAddress[j].Ipv6 != "" {
go UpdateIpTable(Addresses.IpAddress[j].Ipv6, Addresses.IpAddress[j].ServerPort, &w)
} else if Addresses.IpAddress[j].Ipv4 != currentIPV4 {
go UpdateIpTable(Addresses.IpAddress[j].Ipv4, Addresses.IpAddress[j].ServerPort, &w)
}
//if Addresses.IpAddress[j].Ipv6 != "" {
// go UpdateIpTable(Addresses.IpAddress[j].Ipv6, Addresses.IpAddress[j].ServerPort, &w)
//} else if Addresses.IpAddress[j].Ipv4 != currentIPV4 {
// //go UpdateIpTable(Addresses.IpAddress[j].Ipv4, Addresses.IpAddress[j].ServerPort, &w)
//}
go UpdateIpTable(Addresses.IpAddress[j].Ipv4, Addresses.IpAddress[j].ServerPort, &w)
w.Wait()
//Appends server1 IP address to variable DoNotRead