|
|
|
@ -146,6 +146,21 @@ func (ldc *LegacyDecortClient) do(req *http.Request) (*http.Response, error) {
|
|
|
|
|
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
|
|
|
|
resp, err := ldc.client.Do(req)
|
|
|
|
|
if err != nil || resp == nil {
|
|
|
|
|
if strings.Contains(err.Error(),"connection reset by peer") {
|
|
|
|
|
resp.Body.Close()
|
|
|
|
|
for i := uint64(0); i < ldc.cfg.Retries; i++ {
|
|
|
|
|
time.Sleep(5 *time.Second)
|
|
|
|
|
resp, err = ldc.client.Do(req)
|
|
|
|
|
if strings.Contains(err.Error(),"connection reset by peer") {
|
|
|
|
|
resp.Body.Close()
|
|
|
|
|
continue
|
|
|
|
|
} else if err == nil {
|
|
|
|
|
break
|
|
|
|
|
} else if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return resp, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|