Skip to content

Commit

Permalink
Remove side effect from assertion in IPHeaderRemoverHandler (#3129)
Browse files Browse the repository at this point in the history
Motivation:

The 'testRawSocketBootstrap_withProtocolNegotiation' test times out when
run in release mode. This is because 'IPHeaderRemoverHandler' removes
the IPv4 headers as a side effect of an assertion. This means that the
headers are only removed when compiled in debug mode.

Modifications:

Always remove the headers.

Result:

The test passes in release mode.
  • Loading branch information
glbrntt authored Mar 5, 2025
1 parent 3de7a28 commit 4f2d42f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Tests/NIOPosixTests/AsyncChannelBootstrapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ private final class IPHeaderRemoverHandler: ChannelInboundHandler {

func channelRead(context: ChannelHandlerContext, data: NIOAny) {
var data = Self.unwrapInboundIn(data)
assert(data.data.readIPv4Header() != nil)
let header = data.data.readIPv4Header()
assert(header != nil)
context.fireChannelRead(Self.wrapInboundOut(data))
}
}
Expand Down

0 comments on commit 4f2d42f

Please sign in to comment.