aboutsummaryrefslogtreecommitdiff
path: root/weed/operation/upload_content.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-04-17 14:32:24 -0700
committerChris Lu <chris.lu@gmail.com>2021-04-18 13:07:28 -0700
commit2acf6be24e168c4cd6bdeb64244333de17654251 (patch)
tree7da62af5b186becd50cebe935c27282f09bb3f2b /weed/operation/upload_content.go
parent6cbd786db9b96833248444c42992c239f2424d95 (diff)
downloadseaweedfs-2acf6be24e168c4cd6bdeb64244333de17654251.tar.xz
seaweedfs-2acf6be24e168c4cd6bdeb64244333de17654251.zip
resend the http request if connection is stale
Diffstat (limited to 'weed/operation/upload_content.go')
-rw-r--r--weed/operation/upload_content.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go
index 7a7f8aa0c..944186eeb 100644
--- a/weed/operation/upload_content.go
+++ b/weed/operation/upload_content.go
@@ -11,7 +11,6 @@ import (
"net/http"
"net/textproto"
"path/filepath"
- "runtime/debug"
"strings"
"time"
@@ -235,10 +234,12 @@ func upload_content(uploadUrl string, fillBufferFunction func(w io.Writer) error
// print("+")
resp, post_err := HttpClient.Do(req)
if post_err != nil {
- if !strings.Contains(post_err.Error(), "connection reset by peer") {
- glog.Errorf("upload %s %d bytes to %v: %v", filename, originalDataSize, uploadUrl, post_err)
- debug.PrintStack()
+ if strings.Contains(post_err.Error(), "connection reset by peer") ||
+ strings.Contains(post_err.Error(), "use of closed network connection") {
+ resp, post_err = HttpClient.Do(req)
}
+ }
+ if post_err != nil {
return nil, fmt.Errorf("upload %s %d bytes to %v: %v", filename, originalDataSize, uploadUrl, post_err)
}
// print("-")