Skip to content

Commit

Permalink
udpate close
Browse files Browse the repository at this point in the history
  • Loading branch information
MacOMNI committed Oct 25, 2024
1 parent 529f71c commit 9cbfb29
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 0 additions & 3 deletions Networking/Sources/MsQuicSwift/QuicStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ private class StreamHandle {

case QUIC_STREAM_EVENT_PEER_SEND_SHUTDOWN:
logger.trace("Peer send shutdown")
api.call { api in
_ = api.pointee.StreamShutdown(ptr, QUIC_STREAM_SHUTDOWN_FLAG_GRACEFUL, 0)
}

case QUIC_STREAM_EVENT_PEER_SEND_ABORTED:
logger.trace("Peer send aborted")
Expand Down
3 changes: 0 additions & 3 deletions Networking/Sources/Networking/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public final class Connection<Handler: StreamHandler>: Sendable, ConnectionInfoP

var reps = Data()
while let nextData = await stream.receive() {
if nextData.isEmpty { // fin flag
break
}
let length = try decodeLength(from: nextData.prefix(4))
let data = nextData.dropFirst(4).prefix(Int(length))
reps.append(data)
Expand Down
4 changes: 4 additions & 0 deletions Networking/Sources/Networking/Stream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ final class Stream<Handler: StreamHandler>: Sendable, StreamProtocol {
}

func received(data: Data) {
if data.isEmpty {
close(abort: false)
return
}
if !channel.syncSend(data) {
logger.warning("stream \(id) is full")
// TODO: backpressure handling
Expand Down

0 comments on commit 9cbfb29

Please sign in to comment.