Skip to content
Snippets Groups Projects
Commit a10f89b1 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Fix issue where auth and wait timeouts were confused

parent b6bab406
No related branches found
No related tags found
2 merge requests!510Release,!373Fix issue where auth and wait timeouts were confused
...@@ -166,7 +166,7 @@ var rootCmd = &cobra.Command{ ...@@ -166,7 +166,7 @@ var rootCmd = &cobra.Command{
time.Sleep(10 * time.Second) time.Sleep(10 * time.Second)
// Accept auth request for this recipient // Accept auth request for this recipient
waitSecs := viper.GetUint(authTimeoutFlag) authSecs := viper.GetUint(authTimeoutFlag)
authConfirmed := false authConfirmed := false
jww.INFO.Printf("Preexisting E2e partners: %+v", user.GetE2E().GetAllPartnerIDs()) jww.INFO.Printf("Preexisting E2e partners: %+v", user.GetE2E().GetAllPartnerIDs())
if user.GetE2E().HasAuthenticatedChannel(recipientID) { if user.GetE2E().HasAuthenticatedChannel(recipientID) {
...@@ -189,7 +189,7 @@ var rootCmd = &cobra.Command{ ...@@ -189,7 +189,7 @@ var rootCmd = &cobra.Command{
"unexpected request:"+ "unexpected request:"+
" %s", reqID) " %s", reqID)
} }
case <-time.After(time.Duration(waitSecs) * case <-time.After(time.Duration(authSecs) *
time.Second): time.Second):
fmt.Print("timed out on auth request") fmt.Print("timed out on auth request")
reqDone = true reqDone = true
...@@ -245,15 +245,15 @@ var rootCmd = &cobra.Command{ ...@@ -245,15 +245,15 @@ var rootCmd = &cobra.Command{
scnt := uint(0) scnt := uint(0)
// Wait until authConfirmed // Wait until authConfirmed
for !authConfirmed && scnt < waitSecs { for !authConfirmed && scnt < authSecs {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
scnt++ scnt++
} }
if scnt == waitSecs { if scnt == authSecs {
jww.FATAL.Panicf("Could not confirm "+ jww.FATAL.Panicf("Could not confirm "+
"authentication channel for %s, "+ "authentication channel for %s, "+
"waited %d seconds.", recipientID, "waited %d seconds.", recipientID,
waitSecs) authSecs)
} }
jww.INFO.Printf("Authentication channel confirmation"+ jww.INFO.Printf("Authentication channel confirmation"+
" took %d seconds", scnt) " took %d seconds", scnt)
...@@ -359,6 +359,7 @@ var rootCmd = &cobra.Command{ ...@@ -359,6 +359,7 @@ var rootCmd = &cobra.Command{
// TODO: Actually check for how many messages we've received // TODO: Actually check for how many messages we've received
expectedCnt := viper.GetUint(receiveCountFlag) expectedCnt := viper.GetUint(receiveCountFlag)
receiveCnt := uint(0) receiveCnt := uint(0)
waitSecs := viper.GetUint(waitTimeoutFlag)
waitTimeout := time.Duration(waitSecs) * time.Second waitTimeout := time.Duration(waitSecs) * time.Second
done := false done := false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment