From 343020ca275298fe9ea3320628454cad5f0052aa Mon Sep 17 00:00:00 2001 From: Zhaozhong Ni Date: Tue, 5 Jun 2018 15:43:38 -0700 Subject: netstack: make TCP endpoint closed and error state cleanup work synchronous. So that when saving TCP endpoint in these states, there is no pending or background activities. Also lift tcp network save rejection error to tcpip package. PiperOrigin-RevId: 199370748 Change-Id: Ief7b45c2a7338d12414cd7c23db95de6a9c22700 --- pkg/tcpip/tcpip.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pkg/tcpip/tcpip.go') diff --git a/pkg/tcpip/tcpip.go b/pkg/tcpip/tcpip.go index fdeba6bc4..cf25a086d 100644 --- a/pkg/tcpip/tcpip.go +++ b/pkg/tcpip/tcpip.go @@ -85,6 +85,17 @@ var ( errSubnetAddressMasked = errors.New("subnet address has bits set outside the mask") ) +// ErrSaveRejection indicates a failed save due to unsupported networking state. +// This type of errors is only used for save logic. +type ErrSaveRejection struct { + Err error +} + +// Error returns a sensible description of the save rejection error. +func (e ErrSaveRejection) Error() string { + return "save rejected due to unsupported networking state: " + e.Err.Error() +} + // A Clock provides the current time. // // Times returned by a Clock should always be used for application-visible -- cgit v1.2.3