Simon 2 лет назад
Родитель
Сommit
97a77d8e6f
5 измененных файлов с 11 добавлено и 10 удалено
  1. 1 2
      client/client.go
  2. 4 1
      go.mod
  3. 2 0
      go.sum
  4. 4 6
      leader/leader.go
  5. 0 1
      lib/databaseRead.go

+ 1 - 2
client/client.go

@@ -313,7 +313,7 @@ func createPIRQuery(subPhase int, clientNumber int) ([]byte, []byte) {
 		if tmpNeededSubscriptions > len(archiveTopicList) {
 			tmpNeededSubscriptions = len(archiveTopicList)
 		}
-		tmptopicsOfInterest = archiveInterests //!todo take archiveInterests from gui
+		tmptopicsOfInterest = archiveInterests //todo! take archiveInterests from gui
 		tmpTopicList = archiveTopicList
 	}
 
@@ -486,7 +486,6 @@ func receiveTweets(sharedSecret [2][32]byte, leaderConn net.Conn, getArchive boo
 			fmt.Println("error")
 			fmt.Println("round", round, string(tweets), "length", len(tweets))
 			return
-			//panic("received text not of correct format")
 		}
 	}
 }

+ 4 - 1
go.mod

@@ -4,4 +4,7 @@ go 1.17
 
 require golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed
 
-require golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
+require (
+	github.com/pkg/profile v1.6.0
+	golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
+)

+ 2 - 0
go.sum

@@ -1,3 +1,5 @@
+github.com/pkg/profile v1.6.0 h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=
+github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
 golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed h1:YoWVYYAfvQ4ddHv3OKmIvX7NCAhFGTj62VP2l2kfBbA=
 golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=

+ 4 - 6
leader/leader.go

@@ -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

+ 0 - 1
lib/databaseRead.go

@@ -72,7 +72,6 @@ func NewEntries(inputTweets []Tweet, whereTo int) {
 	}
 }
 
-//todo! add round to pirquery only get tweets that have been posted from that round onward
 func GetTweets(pirQuery []byte, dataLength int, whereFrom int, pubKey [32]byte) []byte {
 	tmpdb := dbR
 	if whereFrom == 1 {