Update cancel context usage

This commit is contained in:
世界
2023-04-10 13:00:57 +08:00
parent da82a41697
commit 1e39196bc9
7 changed files with 26 additions and 15 deletions

View File

@@ -102,10 +102,10 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) {
return nil, err
}
client := NewGunServiceClient(clientConn).(GunServiceCustomNameClient)
ctx, cancel := context.WithCancel(ctx)
ctx, cancel := common.ContextWithCancelCause(ctx)
stream, err := client.TunCustomName(ctx, c.serviceName)
if err != nil {
cancel()
cancel(err)
return nil, err
}
return deadline.NewConn(NewGRPCConn(stream, cancel)), nil