summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp/accept.go
diff options
context:
space:
mode:
authorBrian Geffon <bgeffon@google.com>2018-06-26 10:32:22 -0700
committerShentubot <shentubot@google.com>2018-06-26 10:33:24 -0700
commit51c1e510ab79607d80d6b81c2ae8ab308c323a58 (patch)
tree966e93f1f461b5b42bef3569631d9d9ad558e72f /pkg/tcpip/transport/tcp/accept.go
parent0ac11de8d37a1c08fe7068b67671235ee1c32cb8 (diff)
Automated rollback of changelist 201596247
PiperOrigin-RevId: 202151720 Change-Id: I0491172c436bbb32b977f557953ba0bc41cfe299
Diffstat (limited to 'pkg/tcpip/transport/tcp/accept.go')
-rw-r--r--pkg/tcpip/transport/tcp/accept.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/pkg/tcpip/transport/tcp/accept.go b/pkg/tcpip/transport/tcp/accept.go
index 410dfdad4..85adeef0e 100644
--- a/pkg/tcpip/transport/tcp/accept.go
+++ b/pkg/tcpip/transport/tcp/accept.go
@@ -68,8 +68,7 @@ func encodeMSS(mss uint16) uint32 {
// to go above a threshold.
var synRcvdCount struct {
sync.Mutex
- value uint64
- pending sync.WaitGroup
+ value uint64
}
// listenContext is used by a listening endpoint to store state used while
@@ -103,7 +102,6 @@ func incSynRcvdCount() bool {
return false
}
- synRcvdCount.pending.Add(1)
synRcvdCount.value++
return true
@@ -117,7 +115,6 @@ func decSynRcvdCount() {
defer synRcvdCount.Unlock()
synRcvdCount.value--
- synRcvdCount.pending.Done()
}
// newListenContext creates a new listen context.
@@ -295,7 +292,7 @@ func (e *endpoint) handleListenSegment(ctx *listenContext, s *segment) {
opts := parseSynSegmentOptions(s)
if incSynRcvdCount() {
s.incRef()
- go e.handleSynSegment(ctx, s, &opts) // S/R-SAFE: synRcvdCount is the barrier.
+ go e.handleSynSegment(ctx, s, &opts) // S/R-FIXME
} else {
cookie := ctx.createCookie(s.id, s.sequenceNumber, encodeMSS(opts.MSS))
// Send SYN with window scaling because we currently
@@ -384,12 +381,10 @@ func (e *endpoint) protocolListenLoop(rcvWnd seqnum.Size) *tcpip.Error {
return nil
}
if n&notifyDrain != 0 {
- for !e.segmentQueue.empty() {
- s := e.segmentQueue.dequeue()
+ for s := e.segmentQueue.dequeue(); s != nil; s = e.segmentQueue.dequeue() {
e.handleListenSegment(ctx, s)
s.decRef()
}
- synRcvdCount.pending.Wait()
close(e.drainDone)
<-e.undrain
}