From 32477fd484bf23a180ea0b0cb186d33baed0d497 Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Wed, 13 Nov 2024 11:09:02 -0500 Subject: [PATCH] Apply suggestions from code review --- x/disorder/writer.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x/disorder/writer.go b/x/disorder/writer.go index 0abe4250..b624d6d4 100644 --- a/x/disorder/writer.go +++ b/x/disorder/writer.go @@ -29,9 +29,6 @@ type disorderWriter struct { var _ io.Writer = (*disorderWriter)(nil) -// Setting number of hops to 1 will lead to data to get lost on host. -var disorderHopN = 1 - func NewWriter(conn io.Writer, tcpOptions sockopt.TCPOptions, runAtPacketN int) io.Writer { // TODO: Support ReadFrom. return &disorderWriter{ @@ -48,7 +45,8 @@ func (w *disorderWriter) Write(data []byte) (written int, err error) { return 0, fmt.Errorf("failed to get the hop limit: %w", err) } - err = w.tcpOptions.SetHopLimit(disorderHopN) + // Setting number of hops to 1 will lead to data to get lost on host. + err = w.tcpOptions.SetHopLimit(1) if err != nil { return 0, fmt.Errorf("failed to set the hop limit to %d: %w", disorderHopN, err) }