|
@@ -412,7 +412,9 @@ func main() {
|
|
|
log.Println("fullDurationPhase3", time.Since(startPhase3).Seconds())
|
|
|
|
|
|
lib.CleanUpdbR(round)
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
func phase1(id int, phase []byte, followerConnection net.Conn, wg *sync.WaitGroup, m *sync.RWMutex, virtualAddresses []int) {
|
|
@@ -611,9 +613,8 @@ func phase1(id int, phase []byte, followerConnection net.Conn, wg *sync.WaitGrou
|
|
|
}
|
|
|
|
|
|
//loop that waits for new client or leaves phase1 if time is up
|
|
|
- //todo! remove && len(phase1Channel) > 0
|
|
|
for {
|
|
|
- if time.Since(startTimeRound) < maxTimePerRound && len(phase1Channel) > 0 {
|
|
|
+ if time.Since(startTimeRound) < maxTimePerRound || len(phase1Channel) > 0 {
|
|
|
//this worker handles the next client
|
|
|
if len(phase1Channel) > 0 {
|
|
|
break
|
|
@@ -986,15 +987,13 @@ func phase3(id int, phase []byte, followerConnection net.Conn, wg *sync.WaitGrou
|
|
|
|
|
|
phase1Channel <- clientConnection
|
|
|
|
|
|
- //todo! remove && len(phase3Channel) > 0
|
|
|
for {
|
|
|
- if time.Since(startTimeRound) < 2*maxTimePerRound && len(phase3Channel) > 0 {
|
|
|
+ if time.Since(startTimeRound) < 2*maxTimePerRound || len(phase3Channel) > 0 {
|
|
|
//this worker handles the next client
|
|
|
if len(phase3Channel) > 0 {
|
|
|
break
|
|
|
//this worker waits for next client
|
|
|
} else {
|
|
|
- fmt.Print("sleepi")
|
|
|
time.Sleep(1 * time.Second)
|
|
|
}
|
|
|
//times up
|
|
@@ -1019,7 +1018,6 @@ func handleClientDC(wg *sync.WaitGroup, followerConnection net.Conn, channel cha
|
|
|
return true
|
|
|
//this worker waits for next client
|
|
|
} else {
|
|
|
- fmt.Print("sleepydc")
|
|
|
time.Sleep(1 * time.Second)
|
|
|
}
|
|
|
//times up
|