diff options
author | Ian Gudger <igudger@google.com> | 2018-10-20 17:57:19 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-20 17:58:26 -0700 |
commit | d7c11c741752813e56b7d8726a575a520260c56a (patch) | |
tree | bbb3369ce42fa9a52de002946205dbcb19af45e0 /pkg/sentry/socket/unix/transport/connectionless.go | |
parent | b2068cf5a5d43f3898cf389ab2d6151cf61908ac (diff) |
Refcount Unix transport queue
This allows us to release messages in the queue when all users close.
PiperOrigin-RevId: 218033550
Change-Id: I2f6e87650fced87a3977e3b74c64775c7b885c1b
Diffstat (limited to 'pkg/sentry/socket/unix/transport/connectionless.go')
-rw-r--r-- | pkg/sentry/socket/unix/transport/connectionless.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/sentry/socket/unix/transport/connectionless.go b/pkg/sentry/socket/unix/transport/connectionless.go index cd4633106..376e4abb2 100644 --- a/pkg/sentry/socket/unix/transport/connectionless.go +++ b/pkg/sentry/socket/unix/transport/connectionless.go @@ -82,9 +82,13 @@ func (e *connectionlessEndpoint) UnidirectionalConnect() (ConnectedEndpoint, *tc if r == nil { return nil, tcpip.ErrConnectionRefused } + q := r.(*queueReceiver).readQueue + if !q.TryIncRef() { + return nil, tcpip.ErrConnectionRefused + } return &connectedEndpoint{ endpoint: e, - writeQueue: r.(*queueReceiver).readQueue, + writeQueue: q, }, nil } |