forked from quic-go/quic-go
handle request cancelations while waiting for handshake completion
This commit is contained in:
@@ -101,7 +101,6 @@ func (c *client) dial() error {
|
||||
}
|
||||
}()
|
||||
|
||||
<-c.session.HandshakeComplete().Done()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -151,6 +150,13 @@ func (c *client) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
return nil, c.handshakeErr
|
||||
}
|
||||
|
||||
// wait for the handshake to complete
|
||||
select {
|
||||
case <-c.session.HandshakeComplete().Done():
|
||||
case <-req.Context().Done():
|
||||
return nil, req.Context().Err()
|
||||
}
|
||||
|
||||
str, err := c.session.OpenStreamSync(req.Context())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user