sentry/socket: don't release a connected enpoint under the endpoint mutex

It isn't required and can have side effects. For example, the current endpoint
can be in an SCM message that is queued to the connected endpoint.

PiperOrigin-RevId: 447906621
This commit is contained in:
Andrei Vagin
2022-05-10 22:16:49 -07:00
committed by gVisor bot
parent 6af4eedc21
commit 3f44cd556b
@@ -59,10 +59,8 @@ func (e *connectionlessEndpoint) isBound() bool {
// with it.
func (e *connectionlessEndpoint) Close(ctx context.Context) {
e.Lock()
if e.connected != nil {
e.connected.Release(ctx)
e.connected = nil
}
connected := e.connected
e.connected = nil
if e.isBound() {
e.path = ""
@@ -73,6 +71,9 @@ func (e *connectionlessEndpoint) Close(ctx context.Context) {
e.receiver = nil
e.Unlock()
if connected != nil {
connected.Release(ctx)
}
r.CloseNotify()
r.Release(ctx)
}