From e40bd0e5d03d2a77df5ec020be05ad3845fd47e0 Mon Sep 17 00:00:00 2001 From: George Barnett Date: Tue, 14 Jan 2025 11:18:48 +0000 Subject: [PATCH] more warnings --- Sources/NIOWritePCAPDemo/main.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/NIOWritePCAPDemo/main.swift b/Sources/NIOWritePCAPDemo/main.swift index 01f2ffcc..8e7753e0 100644 --- a/Sources/NIOWritePCAPDemo/main.swift +++ b/Sources/NIOWritePCAPDemo/main.swift @@ -77,10 +77,11 @@ defer { let allDonePromise = group.next().makePromise(of: ByteBuffer.self) let connection = try ClientBootstrap(group: group.next()) .channelInitializer { channel in - channel.pipeline.addHandler(NIOWritePCAPHandler(mode: .client, fileSink: fileSink.write)).flatMap { - channel.pipeline.addHTTPClientHandlers() - }.flatMap { - channel.pipeline.addHandler(SendSimpleRequestHandler(allDonePromise: allDonePromise)) + channel.eventLoop.makeCompletedFuture { + let sync = channel.pipeline.syncOperations + try sync.addHandler(NIOWritePCAPHandler(mode: .client, fileSink: fileSink.write)) + try sync.addHTTPClientHandlers() + try sync.addHandlers(SendSimpleRequestHandler(allDonePromise: allDonePromise)) } } .connect(host: "httpbin.org", port: 80)