diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2019-06-12 13:34:47 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-06-12 13:35:50 -0700 |
commit | 70578806e8d3e01fae2249b3e602cd5b05d378a0 (patch) | |
tree | 6909e9f6103e23c43d753d10d9ee424670e8c8cd /pkg/tcpip/transport/tcp/cubic_state.go | |
parent | bb849bad296f372670c2d2cf97424f74cf750ce2 (diff) |
Add support for TCP_CONGESTION socket option.
This CL also cleans up the error returned for setting congestion
control which was incorrectly returning EINVAL instead of ENOENT.
PiperOrigin-RevId: 252889093
Diffstat (limited to 'pkg/tcpip/transport/tcp/cubic_state.go')
-rw-r--r-- | pkg/tcpip/transport/tcp/cubic_state.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/tcp/cubic_state.go b/pkg/tcpip/transport/tcp/cubic_state.go new file mode 100644 index 000000000..d0f58cfaf --- /dev/null +++ b/pkg/tcpip/transport/tcp/cubic_state.go @@ -0,0 +1,29 @@ +// Copyright 2019 The gVisor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tcp + +import ( + "time" +) + +// saveT is invoked by stateify. +func (c *cubicState) saveT() unixTime { + return unixTime{c.t.Unix(), c.t.UnixNano()} +} + +// loadT is invoked by stateify. +func (c *cubicState) loadT(unix unixTime) { + c.t = time.Unix(unix.second, unix.nano) +} |