summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
authorBrian Geffon <bgeffon@google.com>2018-05-16 13:06:23 -0700
committerShentubot <shentubot@google.com>2018-05-16 13:07:12 -0700
commitf295e26b8abe395eaf1d4bee9a792a79b34d156f (patch)
tree261d23af963fd77ceabf52975f1cdd6b419e5b54 /pkg/tcpip
parent4b7e4f3d3612dde08a37a040d5be92c37cd0ee57 (diff)
Release mutex in BidirectionalConnect to avoid deadlock.
When doing a BidirectionalConnect we don't need to continue holding the ConnectingEndpoint's mutex when creating the NewConnectedEndpoint as it was held during the Connect. Additionally, we're not holding the baseEndpoint mutex while Unregistering an event. PiperOrigin-RevId: 196875557 Change-Id: Ied4ceed89de883121c6cba81bc62aa3a8549b1e9
Diffstat (limited to 'pkg/tcpip')
-rw-r--r--pkg/tcpip/transport/unix/unix.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/tcpip/transport/unix/unix.go b/pkg/tcpip/transport/unix/unix.go
index 5fe37eb71..72c21a432 100644
--- a/pkg/tcpip/transport/unix/unix.go
+++ b/pkg/tcpip/transport/unix/unix.go
@@ -677,8 +677,8 @@ type baseEndpoint struct {
// EventRegister implements waiter.Waitable.EventRegister.
func (e *baseEndpoint) EventRegister(we *waiter.Entry, mask waiter.EventMask) {
- e.Lock()
e.Queue.EventRegister(we, mask)
+ e.Lock()
if e.connected != nil {
e.connected.EventUpdate()
}
@@ -687,8 +687,8 @@ func (e *baseEndpoint) EventRegister(we *waiter.Entry, mask waiter.EventMask) {
// EventUnregister implements waiter.Waitable.EventUnregister.
func (e *baseEndpoint) EventUnregister(we *waiter.Entry) {
- e.Lock()
e.Queue.EventUnregister(we)
+ e.Lock()
if e.connected != nil {
e.connected.EventUpdate()
}