Skip to content

Commit b62090c

Browse files
committed
Adopted new condensed API
1 parent 62be3ec commit b62090c

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

Sources/SwiftNetwork/Protocols/ManyToManyProtocol.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,16 @@ extension HeterogeneousManyToManyProtocolHandler where SecondaryFlow: AutomaticU
16321632
guard let flow = self.secondaryFlow(for: flowID) else { throw NetworkError.posix(EINVAL) }
16331633
flow.serviceUpperReceiveQueue()
16341634
}
1635+
1636+
// Enqueue and delivery the datagrams all in one shot
1637+
public func deliverInboundDatagrams(
1638+
flow flowID: MultiplexedFlowIdentifier,
1639+
datagrams: consuming FrameArray
1640+
) throws(NetworkError) {
1641+
guard var flow = self.secondaryFlow(for: flowID) else { throw NetworkError.posix(EINVAL) }
1642+
try flow.addToUpperReceiveQueue(datagrams)
1643+
flow.serviceUpperReceiveQueue()
1644+
}
16351645
}
16361646

16371647
@_spi(ProtocolProvider)

Sources/SwiftNetwork/QUIC/QUICConnection.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5562,8 +5562,7 @@ extension QUICConnection {
55625562

55635563
var frame = frame.frame
55645564
frame.metadataComplete = true
5565-
try? enqueueInboundDatagrams(flow: matchingFlowIdentifier, datagrams: .init(frame: frame))
5566-
try? deliverEnqueuedInboundDatagrams(flow: matchingFlowIdentifier)
5565+
try? deliverInboundDatagrams(flow: matchingFlowIdentifier, datagrams: .init(frame: frame))
55675566
return true
55685567
}
55695568
}

Tests/SwiftNetworkTests/TestMultiplexingProtocol.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ final class TestMultiplexingProtocol: ManyToManyApplicationDatagramProtocol, Man
9191
return
9292
}
9393
accessReceivedDatagrams(path: path) { frames in
94-
try? enqueueInboundDatagrams(flow: flow, datagrams: frames.drainArray())
95-
try? deliverEnqueuedInboundDatagrams(flow: flow)
94+
try? deliverInboundDatagrams(flow: flow, datagrams: frames.drainArray())
9695
}
9796
}
9897

0 commit comments

Comments
 (0)