"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
acd: Fix panic on token expiry - fixes #1117
Nick Craig-Wood40c02989f102
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex 036821741..e4501eff2 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -88,16 +88,15 @@ func init() {// Fs represents a remote acd servertype Fs struct {- name string // name of this remote- features *fs.Features // optional features- c *acd.Client // the connection to the acd server- noAuthClient *http.Client // unauthenticated http client- root string // the path we are working on- dirCache *dircache.DirCache // Map of directory path to directory id- pacer *pacer.Pacer // pacer for API calls- ts *oauthutil.TokenSource // token source for oauth- trueRootID string // ID of true root directory- tokenRenewer *oauthutil.Renew // renew the token on expiry+ name string // name of this remote+ features *fs.Features // optional features+ c *acd.Client // the connection to the acd server+ noAuthClient *http.Client // unauthenticated http client+ root string // the path we are working on+ dirCache *dircache.DirCache // Map of directory path to directory id+ pacer *pacer.Pacer // pacer for API calls+ trueRootID string // ID of true root directory+ tokenRenewer *oauthutil.Renew // renew the token on expiry}// Object describes a acd object@@ -157,8 +156,8 @@ var retryErrorCodes = []int{func (f *Fs) shouldRetry(resp *http.Response, err error) (bool, error) {if resp != nil {if resp.StatusCode == 401 {- f.ts.Invalidate()- fs.Log(f, "401 error received - invalidating token")+ f.tokenRenewer.Invalidate()+ fs.Debug(f, "401 error received - invalidating token")return true, err}// Work around receiving this error sporadically on authenticationdiff --git a/oauthutil/renew.go b/oauthutil/renew.goindex 5604d7ff7..fbbf01223 100644--- a/oauthutil/renew.go+++ b/oauthutil/renew.go@@ -62,3 +62,8 @@ func (r *Renew) Start() {func (r *Renew) Stop() {atomic.AddInt32(&r.uploads, -1)}++// Invalidate invalidates the token source+func (r *Renew) Invalidate() {+ r.ts.Invalidate()+}