diff --git a/Sources/Punchnet/SDLNoticeClient.swift b/Sources/Punchnet/SDLNoticeClient.swift index 73d0afc..44cb4b3 100644 --- a/Sources/Punchnet/SDLNoticeClient.swift +++ b/Sources/Punchnet/SDLNoticeClient.swift @@ -48,10 +48,6 @@ actor SDLNoticeClient { try await self.asyncChannel.executeThenClose { inbound, outbound in try await withThrowingTaskGroup(of: Void.self) { group in group.addTask { - defer { - self.writeContinuation.finish() - } - for try await message in self.writeStream { let buf = self.asyncChannel.channel.allocator.buffer(bytes: message) let envelope = AddressedEnvelope(remoteAddress: self.remoteAddress, data: buf) @@ -72,5 +68,6 @@ actor SDLNoticeClient { deinit { try? self.group.syncShutdownGracefully() + self.writeContinuation.finish() } }