summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2020-03-19 09:41:56 -0700
committergVisor bot <gvisor-bot@google.com>2020-03-19 09:43:23 -0700
commitfd27a917ef068a4e17cddbe3f671b59f52e6e030 (patch)
tree882a8fb41be8805ef233e4033490b0d6427cb069 /pkg/tcpip/transport
parente9e399c25d4fcad2adfe92d73b192b9784774964 (diff)
Address comments on workMu removal change.
Updates #231, #357 PiperOrigin-RevId: 301833669
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r--pkg/tcpip/transport/tcp/accept.go2
-rw-r--r--pkg/tcpip/transport/tcp/tcp_test.go13
2 files changed, 8 insertions, 7 deletions
diff --git a/pkg/tcpip/transport/tcp/accept.go b/pkg/tcpip/transport/tcp/accept.go
index 4d7602d54..3f80995f3 100644
--- a/pkg/tcpip/transport/tcp/accept.go
+++ b/pkg/tcpip/transport/tcp/accept.go
@@ -420,7 +420,7 @@ func (e *endpoint) handleSynSegment(ctx *listenContext, s *segment, opts *header
}
func (e *endpoint) incSynRcvdCount() bool {
- if e.synRcvdCount >= (cap(e.acceptedChan)) {
+ if e.synRcvdCount >= cap(e.acceptedChan) {
return false
}
e.synRcvdCount++
diff --git a/pkg/tcpip/transport/tcp/tcp_test.go b/pkg/tcpip/transport/tcp/tcp_test.go
index 39d36d2ba..ce3df7478 100644
--- a/pkg/tcpip/transport/tcp/tcp_test.go
+++ b/pkg/tcpip/transport/tcp/tcp_test.go
@@ -2236,12 +2236,13 @@ func TestSegmentMerging(t *testing.T) {
c.CreateConnected(789, 30000, -1 /* epRcvBuf */)
- // Send 10 1 byte segments to fill up InitialWindow but don't
- // ACK. That should prevent anymore packets from going out.
- for i := 0; i < 10; i++ {
+ // Send tcp.InitialCwnd number of segments to fill up
+ // InitialWindow but don't ACK. That should prevent
+ // anymore packets from going out.
+ for i := 0; i < tcp.InitialCwnd; i++ {
view := buffer.NewViewFromBytes([]byte{0})
if _, _, err := c.EP.Write(tcpip.SlicePayload(view), tcpip.WriteOptions{}); err != nil {
- t.Fatalf("Write #%d failed: %v", i+1, err)
+ t.Fatalf("Write #%d failed: %s", i+1, err)
}
}
@@ -2256,8 +2257,8 @@ func TestSegmentMerging(t *testing.T) {
}
}
- // Check that we get 10 packets of 1 byte each.
- for i := 0; i < 10; i++ {
+ // Check that we get tcp.InitialCwnd packets.
+ for i := 0; i < tcp.InitialCwnd; i++ {
b := c.GetPacket()
checker.IPv4(t, b,
checker.PayloadLen(header.TCPMinimumSize+1),