aboutsummaryrefslogtreecommitdiff
path: root/provider.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-01-30 16:01:18 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-01-30 16:01:18 +0100
commite4a260c416fad76abeed2bf6f88e90167983e82d (patch)
tree4e619d36b59256d217369949390431cc28290ac2 /provider.go
parentd91ac45502ced8e7f978cc78f4e3633494975a23 (diff)
less magic
Diffstat (limited to 'provider.go')
-rw-r--r--provider.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/provider.go b/provider.go
index 8853c7b..bfc5115 100644
--- a/provider.go
+++ b/provider.go
@@ -30,6 +30,8 @@ const (
mimeJose = "application/jose+json"
mimeProblem = "application/problem+json"
mimePkix = "application/pkix-cert"
+ timeout = time.Second * 5
+ poll = time.Second
)
// RoundTrip implements RoundTipper
@@ -52,7 +54,7 @@ func (p Provider) Nonce() (string, error) {
select {
case nonce := <-p.nonces:
return nonce, nil
- case <-time.After(5 * time.Second):
+ case <-time.After(timeout):
return "", errNoNonces
}
}
@@ -62,7 +64,7 @@ func DialProvider(directory string) (*Provider, error) {
p := &Provider{nonces: make(chan string, 100)}
p.Client = http.Client{
Transport: p,
- Timeout: time.Duration(5 * time.Second),
+ Timeout: time.Duration(timeout),
}
resp, err := p.Get(directory)
if err != nil {
@@ -218,7 +220,7 @@ func (p *Provider) Authorize(s Signer, d *Desire) error {
}
func (p *Provider) pollStatus(uri string) error {
- t := time.NewTicker(time.Second)
+ t := time.NewTicker(poll)
defer t.Stop()
for range t.C {
resp, err := p.Get(uri)