client: fix enforcing timeout to responses (#406)

This commit is contained in:
Alessandro Ros
2023-09-10 16:45:12 +02:00
committed by GitHub
parent e9295e073b
commit af14144d2c

View File

@@ -599,9 +599,12 @@ func (c *Client) runInner() error {
}
func (c *Client) waitResponse() (*base.Response, error) {
t := time.NewTimer(c.ReadTimeout)
defer t.Stop()
for {
select {
case <-time.After(c.ReadTimeout):
case <-t.C:
return nil, liberrors.ErrClientRequestTimedOut{}
case err := <-c.chReadError: