File Sharing MVP #384

Merged
sarah merged 52 commits from filesharing into master 2021-09-30 00:57:14 +00:00
1 changed files with 5 additions and 1 deletions
Showing only changes of commit d20d4b18c2 - Show all commits

View File

@ -12,6 +12,7 @@ import (
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/log"
"github.com/gtank/ristretto255"
"reflect"
"sync"
"time"
)
@ -185,6 +186,7 @@ func (ta *TokenBoardClient) MakePayment() error {
connected, err := client.Connect(ta.tokenServiceOnion, powTokenApp)
if connected == true && err == nil {
log.Debugf("Waiting for successful Token Acquisition...")
conn, err := client.WaitForCapabilityOrClose(ta.tokenServiceOnion, applications.HasTokensCapability)
if err == nil {
powtapp, ok := conn.App().(*applications.TokenApplication)
@ -199,11 +201,13 @@ func (ta *TokenBoardClient) MakePayment() error {
conn.Close()
return nil
}
log.Errorf("invalid case of powapp. this should not happen")
log.Errorf("invalid cast of powapp. this should not happen %v %v", powtapp, reflect.TypeOf(conn.App()))
return errors.New("invalid cast of powapp. this should never happen")
}
log.Debugf("could not connect to payment server %v..trying again")
return ta.MakePayment()
} else if connected && err != nil {
log.Debugf("inexplicable error: %v", err)
}
log.Debugf("failed to make a connection. trying again...")
// it doesn't actually take that long to make a payment, so waiting a small amount of time should suffice