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