From 4f2d42f83f4f29fe08a17e9c57237429d15e155c Mon Sep 17 00:00:00 2001 From: George Barnett Date: Wed, 5 Mar 2025 18:03:22 +0000 Subject: [PATCH] Remove side effect from assertion in IPHeaderRemoverHandler (#3129) 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. --- Tests/NIOPosixTests/AsyncChannelBootstrapTests.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/NIOPosixTests/AsyncChannelBootstrapTests.swift b/Tests/NIOPosixTests/AsyncChannelBootstrapTests.swift index 68604ef0f4..7d365c3620 100644 --- a/Tests/NIOPosixTests/AsyncChannelBootstrapTests.swift +++ b/Tests/NIOPosixTests/AsyncChannelBootstrapTests.swift @@ -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)) } }