Skip to content

Commit

Permalink
Check if reverting the new NIO test alone fixes the macOS CI
Browse files Browse the repository at this point in the history
  • Loading branch information
finagolfin committed Jan 18, 2025
1 parent c40985d commit b8da076
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions swift-nio-revert-async.patch
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
diff --git a/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift b/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift
index badc34f967..f232d518f9 100644
--- a/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift
+++ b/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift
@@ -1173,7 +1173,38 @@ extension NIOAsyncWriter {
delegate: delegate
)

- case .initial, .finished, .writerFinished:
+ case .writerFinished(
+ let isWritable,
+ let inDelegateOutcall,
+ var suspendedYields,
+ let cancelledYields,
+ let bufferedYieldIDs,
+ let delegate,
+ let error
+ ):
+ // We have a suspended yield at this point that hasn't been cancelled yet.
+ // It was buffered before we became finished, so we still have to deliver it.
+ // We need to store the yield now.
+
+ self._state = .modifying
+
+ let suspendedYield = SuspendedYield(
+ yieldID: yieldID,
+ continuation: continuation
+ )
+ suspendedYields.append(suspendedYield)
+
+ self._state = .writerFinished(
+ isWritable: isWritable,
+ inDelegateOutcall: inDelegateOutcall,
+ suspendedYields: suspendedYields,
+ cancelledYields: cancelledYields,
+ bufferedYieldIDs: bufferedYieldIDs,
+ delegate: delegate,
+ error: error
+ )
+
+ case .initial, .finished:
preconditionFailure("This should have already been handled by `yield()`")

case .modifying:
@@ -1501,7 +1532,7 @@ extension NIOAsyncWriter {

self._state = .writerFinished(
isWritable: isWritable,
- inDelegateOutcall: inDelegateOutcall,
+ inDelegateOutcall: false,
suspendedYields: .init(),
cancelledYields: cancelledYields,
bufferedYieldIDs: bufferedYieldIDs,
diff --git a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift b/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift
index 31c680b8bf..4f15ac9af9 100644
--- a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift
Expand Down

0 comments on commit b8da076

Please sign in to comment.