ginuerzh / weedo

a SeaWeedFS client written in golang
https://github.com/chrislusf/seaweedfs
Apache License 2.0
49 stars 17 forks source link

fix weed.Delete() crash bugs. #3

Closed chennqqi closed 7 years ago

chennqqi commented 7 years ago

a http post can be closed only if a resp is valid

This hanppend when an fid not exist or removed already.

ginuerzh commented 7 years ago

I think it should be defer resp.Close() if no error occurred, no matter whether http.StatusCode is StatusOK.

chennqqi commented 7 years ago

@ginuerzh You're right. but call resp.Close() must judge if http.Do returned an error. I update defer resp.Close() before whether http.StatusCode is StatusOK.