aboutsummaryrefslogtreecommitdiffstats
path: root/drive/timeout_reader.go
diff options
context:
space:
mode:
authorPetter Rasmussen2016-02-20 23:11:23 +0100
committerPetter Rasmussen2016-02-20 23:39:11 +0100
commita9e9da783481fcb8022eb52fb944cb9ee13997de (patch)
treef817301b74f0f1787e310c8d6f2560bbb9cce457 /drive/timeout_reader.go
parent308c7dceac93e7496453332139aac006da408629 (diff)
downloadgdrive-a9e9da783481fcb8022eb52fb944cb9ee13997de.tar.bz2
Wrap media uploads in TimeoutReader
Diffstat (limited to 'drive/timeout_reader.go')
-rw-r--r--drive/timeout_reader.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/drive/timeout_reader.go b/drive/timeout_reader.go
index e228160..ba2bb83 100644
--- a/drive/timeout_reader.go
+++ b/drive/timeout_reader.go
@@ -10,6 +10,11 @@ import (
const MaxIdleTimeout = time.Second * 120
const TimeoutTimerInterval = time.Second * 10
+func getTimeoutReaderContext(r io.Reader) (io.Reader, context.Context) {
+ ctx, cancel := context.WithCancel(context.TODO())
+ return getTimeoutReader(r, cancel), ctx
+}
+
func getTimeoutReader(r io.Reader, cancel context.CancelFunc) io.Reader {
return &TimeoutReader{
reader: r,