aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-06-05 10:24:25 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-06-05 10:24:25 +0200
commit6e6292853e7844741b09cbfb88be3c73e273b869 (patch)
tree72575a8dab2475f71b44d9890f9d86a500be6c9f
parent42f610d4b746ef068e6515e4688387ab13d799b2 (diff)
non-blocking nonce write
-rw-r--r--signer.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/signer.go b/signer.go
index 3eb25fc..3f7314d 100644
--- a/signer.go
+++ b/signer.go
@@ -94,10 +94,10 @@ func (s Signer) RoundTrip(req *http.Request) (*http.Response, error) {
return nil, err
}
if nonce := resp.Header.Get("Replay-Nonce"); nonce != "" {
- if len(s.nonces) == cap(s.nonces) {
- <-s.nonces // drop oldest
+ select {
+ case s.nonces <- nonce:
+ default:
}
- s.nonces <- nonce
}
return resp, nil
}