diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-11-11 14:13:50 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-11-11 14:15:06 -0800 |
commit | 773071680021a2fb985f3a3af7e9f65cdc1bd1ed (patch) | |
tree | 092d2346062bdd12253e707ddcc2960fde90d7f9 /pkg/tcpip/transport/tcp/tcp_test.go | |
parent | 833dbba70dbcfef4a9aca950055a28d71c19d543 (diff) |
Make `connect` on socket returned by `accept` correctly error out with EISCONN
PiperOrigin-RevId: 279814493
Diffstat (limited to 'pkg/tcpip/transport/tcp/tcp_test.go')
-rw-r--r-- | pkg/tcpip/transport/tcp/tcp_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/tcp/tcp_test.go b/pkg/tcpip/transport/tcp/tcp_test.go index 0c1704d74..84579ce52 100644 --- a/pkg/tcpip/transport/tcp/tcp_test.go +++ b/pkg/tcpip/transport/tcp/tcp_test.go @@ -4599,6 +4599,9 @@ func TestEndpointBindListenAcceptState(t *testing.T) { if got, want := tcp.EndpointState(aep.State()), tcp.StateEstablished; got != want { t.Errorf("Unexpected endpoint state: want %v, got %v", want, got) } + if err := aep.Connect(tcpip.FullAddress{Addr: context.TestAddr, Port: context.TestPort}); err != tcpip.ErrAlreadyConnected { + t.Errorf("Unexpected error attempting to call connect on an established endpoint, got: %v, want: %v", err, tcpip.ErrAlreadyConnected) + } // Listening endpoint remains in listen state. if got, want := tcp.EndpointState(ep.State()), tcp.StateListen; got != want { t.Errorf("Unexpected endpoint state: want %v, got %v", want, got) |