aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'account.go')
-rw-r--r--account.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/account.go b/account.go
index d116bed..a17d931 100644
--- a/account.go
+++ b/account.go
@@ -33,7 +33,7 @@ func NewAccount(email string, bits int) (*Account, error) {
return &Account{
Contact: []string{"mailto:" + m.Address},
PrivKey: key,
- nonce: make(chan string, 100),
+ nonce: make(chan string, 10), // shall be enough
}, nil
}
@@ -67,10 +67,12 @@ var errNoNonces = errors.New("No nonces available")
// Nonce implements jose nonce provider
func (a Account) Nonce() (string, error) {
- if nonce, ok := <-a.nonce; ok {
+ select {
+ case nonce := <-a.nonce:
return nonce, nil
+ default:
+ return "", errNoNonces
}
- return "", errNoNonces
}
func (a Account) parseNonce(r *http.Response) {