Change MessageType from u16 to u32
Breaking wire protocol change: MessageType field increased from 2 bytes to 4 bytes in LP packets. This future-proofs the message type space and aligns with other u32 fields. Changes: - message.rs: #[repr(u32)], from_u32(), to_u32() - error.rs: InvalidMessageType(u32) - codec.rs: All serialization/deserialization updated to 4-byte msg_type - Cleartext parsing: inner_bytes[4..8], content at [8..] - AEAD parsing: decrypted[4..8], content at [8..] - Serialization: 4 bytes for message type
This commit is contained in:
committed by
Jędrzej Stuczyński
parent
7ebacde1fc
commit
9eb8cc2de8
@@ -453,7 +453,12 @@ impl LpConnectionHandler {
|
||||
// Get outer key before releasing borrow
|
||||
let outer_key = state_machine
|
||||
.session()
|
||||
.map_err(|e| GatewayError::LpProtocolError(format!("Session unavailable after processing: {}", e)))?
|
||||
.map_err(|e| {
|
||||
GatewayError::LpProtocolError(format!(
|
||||
"Session unavailable after processing: {}",
|
||||
e
|
||||
))
|
||||
})?
|
||||
.outer_aead_key();
|
||||
drop(state_entry);
|
||||
|
||||
@@ -1130,8 +1135,9 @@ mod tests {
|
||||
timestamp_tolerance_secs: 30,
|
||||
..Default::default()
|
||||
};
|
||||
let forward_semaphore =
|
||||
Arc::new(tokio::sync::Semaphore::new(lp_config.max_concurrent_forwards));
|
||||
let forward_semaphore = Arc::new(tokio::sync::Semaphore::new(
|
||||
lp_config.max_concurrent_forwards,
|
||||
));
|
||||
|
||||
LpHandlerState {
|
||||
lp_config,
|
||||
|
||||
@@ -361,7 +361,7 @@ pub struct LpHandlerState {
|
||||
/// Prevents file descriptor exhaustion when forwarding LP packets during
|
||||
/// telescope setup. When at capacity, forward requests return an error
|
||||
/// so clients can choose a different gateway.
|
||||
// AIDEV-NOTE: Connection limiting (not pooling) chosen for forward requests.
|
||||
// Connection limiting (not pooling) chosen for forward requests.
|
||||
//
|
||||
// Why not connection pooling?
|
||||
// 1. Forwarding is one-time per telescope setup (handshake only), not ongoing traffic.
|
||||
|
||||
Reference in New Issue
Block a user