Minor fixes
This commit is contained in:
parent
14c8f75f7a
commit
c17af6ee8c
13 changed files with 357 additions and 181 deletions
|
|
@ -42,16 +42,22 @@ func (c *gLazyConn) HandshakeContext(ctx context.Context) error {
|
|||
wq waiter.Queue
|
||||
endpoint tcpip.Endpoint
|
||||
)
|
||||
handshakeCtx, cancel := context.WithCancel(ctx)
|
||||
go func() {
|
||||
select {
|
||||
case <-c.parentCtx.Done():
|
||||
wq.Notify(wq.Events())
|
||||
case <-handshakeCtx.Done():
|
||||
}
|
||||
}()
|
||||
var cancel context.CancelFunc
|
||||
if parentDone := c.parentCtx.Done(); parentDone != nil {
|
||||
var handshakeCtx context.Context
|
||||
handshakeCtx, cancel = context.WithCancel(ctx)
|
||||
go func() {
|
||||
select {
|
||||
case <-parentDone:
|
||||
wq.Notify(wq.Events())
|
||||
case <-handshakeCtx.Done():
|
||||
}
|
||||
}()
|
||||
}
|
||||
endpoint, err := c.request.CreateEndpoint(&wq)
|
||||
cancel()
|
||||
if cancel != nil {
|
||||
cancel()
|
||||
}
|
||||
if err != nil {
|
||||
gErr := gonet.TranslateNetstackError(err)
|
||||
c.handshakeErr = gErr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue