aboutsummaryrefslogtreecommitdiffstats
path: root/drive/upload.go
diff options
context:
space:
mode:
authorPetter Rasmussen2016-04-09 18:04:39 +0200
committerPetter Rasmussen2016-04-09 18:37:33 +0200
commit0e1057e475525536dce2db4754e9d9840ab086f2 (patch)
treee1a1147ba447d8609752594140c82a109772c44c /drive/upload.go
parent401e017c5e821ba1dff9bc7e45e809b63c800192 (diff)
downloadgdrive-0e1057e475525536dce2db4754e9d9840ab086f2.tar.bz2
Configurable timeout as argument #127
Diffstat (limited to 'drive/upload.go')
-rw-r--r--drive/upload.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/drive/upload.go b/drive/upload.go
index c42bebd..6f5edd5 100644
--- a/drive/upload.go
+++ b/drive/upload.go
@@ -22,6 +22,7 @@ type UploadArgs struct {
Share bool
Delete bool
ChunkSize int64
+ Timeout time.Duration
}
func (self *Drive) Upload(args UploadArgs) error {
@@ -173,7 +174,7 @@ func (self *Drive) uploadFile(args UploadArgs) (*drive.File, int64, error) {
progressReader := getProgressReader(srcFile, args.Progress, srcFileInfo.Size())
// Wrap reader in timeout reader
- reader, ctx := getTimeoutReaderContext(progressReader)
+ reader, ctx := getTimeoutReaderContext(progressReader, args.Timeout)
fmt.Fprintf(args.Out, "Uploading %s\n", args.Path)
started := time.Now()
@@ -198,6 +199,7 @@ type UploadStreamArgs struct {
Share bool
ChunkSize int64
Progress io.Writer
+ Timeout time.Duration
}
func (self *Drive) UploadStream(args UploadStreamArgs) error {
@@ -223,7 +225,7 @@ func (self *Drive) UploadStream(args UploadStreamArgs) error {
progressReader := getProgressReader(args.In, args.Progress, 0)
// Wrap reader in timeout reader
- reader, ctx := getTimeoutReaderContext(progressReader)
+ reader, ctx := getTimeoutReaderContext(progressReader, args.Timeout)
fmt.Fprintf(args.Out, "Uploading %s\n", dstFile.Name)
started := time.Now()