Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna authored Nov 13, 2024
1 parent c801550 commit 32477fd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions x/disorder/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
}
Expand Down

0 comments on commit 32477fd

Please sign in to comment.