Refactor node/handlers.rs and node/tests.rs into subdirectories

Split handlers.rs (986 lines) into handlers/ with 5 subfiles organized
by responsibility: rx_loop, encrypted, handshake, dispatch, timeout.

Split tests.rs (2350 lines) into tests/ with 4 subfiles: unit tests,
handshake integration, spanning tree convergence, and bloom filter tests.
Shared test helpers extracted to tests/mod.rs.

Visibility adjusted from pub(super) to pub(in crate::node) for handler
methods now two levels deep. Unused imports cleaned up in node/mod.rs.

All 316 tests pass, zero warnings.
This commit is contained in:
Johnathan Corgan
2026-02-11 03:49:45 +00:00
parent 5d7af5b478
commit cc29c51cac
13 changed files with 2766 additions and 2709 deletions
+3 -8
View File
@@ -15,21 +15,16 @@ mod tests;
use crate::bloom::BloomState;
use crate::cache::CoordCache;
use crate::index::IndexAllocator;
use crate::peer::{
cross_connection_winner, ActivePeer, PeerConnection, PromotionResult,
};
use crate::peer::{ActivePeer, PeerConnection};
use crate::rate_limit::HandshakeRateLimiter;
use crate::transport::{
packet_channel, Link, LinkDirection, LinkId, PacketRx, PacketTx, ReceivedPacket,
packet_channel, Link, LinkDirection, LinkId, PacketRx, PacketTx,
TransportAddr, TransportHandle, TransportId,
};
use crate::transport::udp::UdpTransport;
use crate::tree::TreeState;
use crate::tun::{run_tun_reader, shutdown_tun_interface, TunDevice, TunError, TunState, TunTx};
use crate::wire::{
build_encrypted, build_msg1, build_msg2, EncryptedHeader, Msg1Header, Msg2Header,
DISCRIMINATOR_ENCRYPTED, DISCRIMINATOR_MSG1, DISCRIMINATOR_MSG2,
};
use crate::wire::{build_encrypted, build_msg1};
use crate::{Config, ConfigError, Identity, IdentityError, NodeAddr, PeerIdentity};
use std::collections::HashMap;
use std::fmt;