Skip to content
Snippets Groups Projects
Commit 1ceb41d6 authored by Josh Brooks's avatar Josh Brooks
Browse files

In cmd/ verify confirm sending on verify-send flag

parent e29d36b9
No related branches found
No related tags found
1 merge request!510Release
...@@ -10,6 +10,7 @@ package cmd ...@@ -10,6 +10,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/spf13/viper"
"gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/client/xxdk"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
...@@ -46,10 +47,12 @@ func (a *authCallbacks) Request(requestor contact.Contact, ...@@ -46,10 +47,12 @@ func (a *authCallbacks) Request(requestor contact.Contact,
if a.autoConfirm { if a.autoConfirm {
jww.INFO.Printf("Channel Request: %s", jww.INFO.Printf("Channel Request: %s",
requestor.ID) requestor.ID)
_, err := a.client.GetAuth().Confirm(requestor) if viper.GetBool("verify-sends") { // Verify message sends were successful
if err != nil { acceptChannelVerified(a.client, requestor.ID)
jww.FATAL.Panicf("%+v", err) } else {
acceptChannel(a.client, requestor.ID)
} }
a.confCh <- requestor.ID a.confCh <- requestor.ID
} }
......
...@@ -263,12 +263,11 @@ var rootCmd = &cobra.Command{ ...@@ -263,12 +263,11 @@ var rootCmd = &cobra.Command{
// Accept auth request for this recipient // Accept auth request for this recipient
authConfirmed := false authConfirmed := false
paramsE2E := e2e.GetDefaultParams() paramsE2E := e2e.GetDefaultParams()
roundTimeout := paramsE2E.CMIXParams.SendTimeout
if viper.GetBool("accept-channel") { if viper.GetBool("accept-channel") {
// Verify that the confirmation message makes it to the // Verify that the confirmation message makes it to the
// original sender // original sender
if viper.GetBool("verify-sends") { if viper.GetBool("verify-sends") {
acceptChannelVerified(client, recipientID, roundTimeout) acceptChannelVerified(client, recipientID)
} else { } else {
// Accept channel, agnostic of round result // Accept channel, agnostic of round result
acceptChannel(client, recipientID) acceptChannel(client, recipientID)
...@@ -832,8 +831,10 @@ func resetAuthenticatedChannel(client *xxdk.E2e, recipientID *id.ID, ...@@ -832,8 +831,10 @@ func resetAuthenticatedChannel(client *xxdk.E2e, recipientID *id.ID,
} }
} }
func acceptChannelVerified(client *xxdk.E2e, recipientID *id.ID, func acceptChannelVerified(client *xxdk.E2e, recipientID *id.ID) {
roundTimeout time.Duration) { paramsE2E := e2e.GetDefaultParams()
roundTimeout := paramsE2E.CMIXParams.SendTimeout
done := make(chan struct{}, 1) done := make(chan struct{}, 1)
retryChan := make(chan struct{}, 1) retryChan := make(chan struct{}, 1)
for { for {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment