Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/freenet-ping/app/tests/run_app_blocked_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,12 @@ async fn test_ping_blocked_peers_simple() -> TestResult {
// as they only varied in non-functional aspects like timeouts and logging

/// Solution/reference implementation for blocked peers
// TODO-MUST-FIX: WebSocket connection reset during teardown - see issue #2108
// Test passes functionally (PUT/GET/Subscribe/state propagation all work) but
// fails with "Connection reset without closing handshake" during cleanup.
// Likely a test teardown race rather than functional bug.
#[tokio::test(flavor = "multi_thread")]
#[ignore = "fix me"]
#[ignore]
async fn test_ping_blocked_peers_solution() -> TestResult {
run_blocked_peers_test(BlockedPeersConfig {
test_name: "solution",
Expand Down
7 changes: 7 additions & 0 deletions crates/core/src/node/network_bridge/p2p_protoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,13 @@ impl P2pConnManager {
} => {
tracing::debug!(%tx, %key, "local subscribe complete");

// If this is a child operation, complete it and let the parent flow handle result delivery.
if op_manager.is_sub_operation(tx) {
tracing::info!(%tx, %key, "completing child subscribe operation");
op_manager.completed(tx);
continue;
}

if !op_manager.is_sub_operation(tx) {
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is redundant because the same condition !op_manager.is_sub_operation(tx) is already checked on line 980 (immediately above). The inner if block on line 986 will always evaluate to true because if we reached this point, the condition on line 980 must have been false.

Consider removing this redundant check and simplifying the code:

// Already checked above, no need to check again
let response = Ok(HostResponse::ContractResponse(
    ContractResponse::SubscribeResponse { key, subscribed },
));

Copilot uses AI. Check for mistakes.
let response = Ok(HostResponse::ContractResponse(
ContractResponse::SubscribeResponse { key, subscribed },
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ where
"root operation awaiting child completion"
);

// Track the root op so child completions can finish it later.
op_manager
.root_ops_awaiting_sub_ops()
.insert(tx_id, final_state);
tracing::info!(%tx_id, "root operation registered as awaiting sub-ops");

return Ok(None);
}
Expand Down
7 changes: 7 additions & 0 deletions crates/core/src/ring/connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ impl ConnectionManager {
self.transient_connections.contains_key(peer)
}

#[allow(dead_code)]
pub fn is_transient_addr(&self, addr: &SocketAddr) -> bool {
self.transient_connections
.iter()
.any(|entry| entry.key().addr == *addr)
}

pub fn transient_count(&self) -> usize {
self.transient_in_use.load(Ordering::Acquire)
}
Expand Down
Loading