summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/queue
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2018-06-26 12:40:23 -0700
committerShentubot <shentubot@google.com>2018-06-26 12:41:22 -0700
commit5f7f78c1d7ee19b6a193d17c48f78edb220412aa (patch)
tree4a03734b643e353488b529c1e732c0a64c5f2dde /pkg/tcpip/transport/queue
parent33041b36cb7e8e9795545837355e4576ff2be4da (diff)
Fix data races in Unix sockets
PiperOrigin-RevId: 202175558 Change-Id: I0113cb9a90d7a0cd7964bf43eef67f70c92d9589
Diffstat (limited to 'pkg/tcpip/transport/queue')
-rw-r--r--pkg/tcpip/transport/queue/queue.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/queue/queue.go b/pkg/tcpip/transport/queue/queue.go
index 2d2918504..0c90588ae 100644
--- a/pkg/tcpip/transport/queue/queue.go
+++ b/pkg/tcpip/transport/queue/queue.go
@@ -157,6 +157,8 @@ func (q *Queue) Peek() (Entry, *tcpip.Error) {
// QueuedSize returns the number of bytes currently in the queue, that is, the
// number of readable bytes.
func (q *Queue) QueuedSize() int64 {
+ q.mu.Lock()
+ defer q.mu.Unlock()
return q.used
}