Skip to content

Commit 421b236

Browse files
committed
Fix "Fix gLazyConn race"
1 parent 3df19f4 commit 421b236

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stack_gvisor_lazy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ func (c *gLazyConn) Close() error {
145145
c.handshakeErr = net.ErrClosed
146146
c.handshakeDone = true
147147
return nil
148+
} else if c.handshakeErr != nil {
149+
return nil
148150
}
149151
c.handshakeAccess.Unlock()
150152
}
@@ -159,6 +161,8 @@ func (c *gLazyConn) CloseRead() error {
159161
c.handshakeErr = net.ErrClosed
160162
c.handshakeDone = true
161163
return nil
164+
} else if c.handshakeErr != nil {
165+
return nil
162166
}
163167
c.handshakeAccess.Unlock()
164168
}
@@ -173,6 +177,8 @@ func (c *gLazyConn) CloseWrite() error {
173177
c.handshakeErr = net.ErrClosed
174178
c.handshakeDone = true
175179
return nil
180+
} else if c.handshakeErr != nil {
181+
return nil
176182
}
177183
c.handshakeAccess.Unlock()
178184
}

0 commit comments

Comments
 (0)