Skip to content

Commit

Permalink
update coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MacOMNI committed Nov 27, 2024
1 parent 3233174 commit 87c5147
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions Networking/Sources/Networking/Peer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,7 @@ private struct PeerEventHandler<Handler: StreamHandler>: QuicEventHandler {
connections.byId[connection.id]
}
guard let conn else {
logger.warning(
"Connected but connection is gone?", metadata: ["connectionId": "\(connection.id)"]
)
logger.warning("Connected but connection is gone?", metadata: ["connectionId": "\(connection.id)"])

Check warning on line 477 in Networking/Sources/Networking/Peer.swift

View check run for this annotation

Codecov / codecov/patch

Networking/Sources/Networking/Peer.swift#L477

Added line #L477 was not covered by tests
return
}

Expand Down Expand Up @@ -506,17 +504,17 @@ private struct PeerEventHandler<Handler: StreamHandler>: QuicEventHandler {
connections.byId[connection.id]
}
let needReconnect = impl.connections.write { connections in
var needReconnect = false
if let conn = connections.byId[connection.id] {
let needReconnect = conn.needReconnect
needReconnect = conn.needReconnect
if let publicKey = conn.publicKey {
connections.byPublicKey.removeValue(forKey: publicKey)
}
connections.byId.removeValue(forKey: connection.id)
connections.byAddr.removeValue(forKey: conn.remoteAddress)
conn.closed()
return needReconnect
}
return false
return needReconnect
}
if needReconnect, let address = conn?.remoteAddress, let role = conn?.role {
do {
Expand Down Expand Up @@ -601,21 +599,11 @@ private struct PeerEventHandler<Handler: StreamHandler>: QuicEventHandler {
if let connection {
connection.streamClosed(stream: stream, abort: !status.isSucceeded)
if shouldReopenStream(connection: connection, stream: stream, status: status) {
do {
if let kind = stream.kind {
impl.reopenUpStream(connection: connection, kind: kind)
}
if let kind = stream.kind {
impl.reopenUpStream(connection: connection, kind: kind)

Check warning on line 603 in Networking/Sources/Networking/Peer.swift

View check run for this annotation

Codecov / codecov/patch

Networking/Sources/Networking/Peer.swift#L602-L603

Added lines #L602 - L603 were not covered by tests
}
}
} else {
logger.warning(
"Stream closed but connection is gone?", metadata: ["streamId": "\(stream.id)"]
)
}
} else {
logger.warning(
"Stream closed but stream is gone?", metadata: ["streamId": "\(quicStream.id)"]
)
}
}

Expand Down

0 comments on commit 87c5147

Please sign in to comment.