1// Go 1.0 compatibility functions
2
3// +build !go1.1
4
5package swift
6
7import (
8	"log"
9	"net/http"
10	"time"
11)
12
13// Cancel the request - doesn't work under < go 1.1
14func cancelRequest(transport http.RoundTripper, req *http.Request) {
15	log.Printf("Tried to cancel a request but couldn't - recompile with go 1.1")
16}
17
18// Reset a timer - Doesn't work properly < go 1.1
19//
20// This is quite hard to do properly under go < 1.1 so we do a crude
21// approximation and hope that everyone upgrades to go 1.1 quickly
22func resetTimer(t *time.Timer, d time.Duration) {
23	t.Stop()
24	// Very likely this doesn't actually work if we are already
25	// selecting on t.C.  However we've stopped the original timer
26	// so won't break transfers but may not time them out :-(
27	*t = *time.NewTimer(d)
28}
29