summaryrefslogtreecommitdiffhomepage
path: root/test/packetimpact/testbench/connections.go
diff options
context:
space:
mode:
authorEyal Soha <eyalsoha@google.com>2020-04-16 15:14:44 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-16 15:15:50 -0700
commit75e864fc7529bf71484ecabbb2ce2264e96399cf (patch)
tree580d427f24537cb05f3e5a177f9efa0b9f172270 /test/packetimpact/testbench/connections.go
parent5a8ee1beee364559bac37376949de1ea01d00ae2 (diff)
Use multierr in packetimpact Connection.Close()
PiperOrigin-RevId: 306930652
Diffstat (limited to 'test/packetimpact/testbench/connections.go')
-rw-r--r--test/packetimpact/testbench/connections.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/packetimpact/testbench/connections.go b/test/packetimpact/testbench/connections.go
index c1b3c4380..f84fd8ba7 100644
--- a/test/packetimpact/testbench/connections.go
+++ b/test/packetimpact/testbench/connections.go
@@ -26,6 +26,7 @@ import (
"time"
"github.com/mohae/deepcopy"
+ "go.uber.org/multierr"
"golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/header"
@@ -382,17 +383,15 @@ func (conn *Connection) match(override, received Layers) bool {
// Close frees associated resources held by the Connection.
func (conn *Connection) Close() {
- if err := conn.sniffer.close(); err != nil {
- conn.t.Fatal(err)
- }
- if err := conn.injector.close(); err != nil {
- conn.t.Fatal(err)
- }
+ errs := multierr.Combine(conn.sniffer.close(), conn.injector.close())
for _, s := range conn.layerStates {
if err := s.close(); err != nil {
- conn.t.Fatalf("unable to close %+v: %s", s, err)
+ errs = multierr.Append(errs, fmt.Errorf("unable to close %+v: %s", s, err))
}
}
+ if errs != nil {
+ conn.t.Fatalf("unable to close %+v: %s", conn, errs)
+ }
}
// CreateFrame builds a frame for the connection with layer overriding defaults