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 3c21774 commit 26caff4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion Networking/Sources/Networking/Peer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,15 @@ private struct PeerEventHandler<Handler: StreamHandler>: QuicEventHandler {
impl.reopenUpStream(connection: connection, kind: kind)
}
}
} 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 All @@ -617,7 +625,7 @@ private struct PeerEventHandler<Handler: StreamHandler>: QuicEventHandler {
case .connectionIdle, .badCert:
return false
default:
return !status.isSucceeded
return status.isSucceeded
}
}
}
6 changes: 3 additions & 3 deletions Networking/Tests/NetworkingTests/PeerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ struct PeerTests {
let con = try peer.connect(to: centerPeer.listenAddress(), role: .builder)
try await con.ready()
}
// Simulate close connections 3~5s
try? await Task.sleep(for: .milliseconds(5000))
// Simulate close connections 5~8s
try? await Task.sleep(for: .milliseconds(8000))
centerPeer.broadcast(kind: .uniqueA, message: .init(kind: .uniqueA, data: Data("connection rotation strategy".utf8)))
try? await Task.sleep(for: .milliseconds(1000))
var receivedCount = 0
Expand Down Expand Up @@ -323,7 +323,7 @@ struct PeerTests {
}
stream!.close(abort: true)
// Wait to simulate downtime & reopen up stream 3~5s
try? await Task.sleep(for: .milliseconds(3000))
try? await Task.sleep(for: .milliseconds(5000))
messageData = Data("reopen up stream data".utf8)
peer1.broadcast(
kind: .uniqueA, message: .init(kind: .uniqueA, data: messageData)
Expand Down

0 comments on commit 26caff4

Please sign in to comment.