mirror of https://github.com/ospab/ostp.git
fix(core): improve UoT tracing and test coverage
This commit is contained in:
parent
b9c6022b6c
commit
855ef7655f
|
|
@ -52,7 +52,7 @@ impl NoiseSession {
|
||||||
match self {
|
match self {
|
||||||
NoiseSession::Handshake(hs) => hs
|
NoiseSession::Handshake(hs) => hs
|
||||||
.read_message(input, out)
|
.read_message(input, out)
|
||||||
.map_err(|_| ProtocolError::Crypto("noise-read".to_string())),
|
.map_err(|e| ProtocolError::Crypto(format!("noise-read: {:?}", e))),
|
||||||
NoiseSession::Transport(_) => Err(ProtocolError::State("noise already in transport".to_string())),
|
NoiseSession::Transport(_) => Err(ProtocolError::State("noise already in transport".to_string())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,8 +240,11 @@ impl ProtocolMachine {
|
||||||
noise_len, raw_vec.len() - 6
|
noise_len, raw_vec.len() - 6
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
tracing::info!("handle_inbound: raw_vec.len()={}, noise_len={}, raw_vec[0..6]={:?}", raw_vec.len(), noise_len, &raw_vec[0..6]);
|
||||||
|
|
||||||
let mut read_out = vec![0_u8; 1024];
|
let mut read_out = vec![0_u8; 1024];
|
||||||
let n = self.noise.read_handshake(&raw_vec[6..6 + noise_len], &mut read_out)?;
|
let n = self.noise.read_handshake(&raw_vec[6..6 + noise_len], &mut read_out)?;
|
||||||
|
read_out.truncate(n);
|
||||||
|
|
||||||
let response = match self.role {
|
let response = match self.role {
|
||||||
NoiseRole::Responder => {
|
NoiseRole::Responder => {
|
||||||
|
|
@ -775,6 +778,7 @@ mod tests {
|
||||||
max_sent_history: 1024,
|
max_sent_history: 1024,
|
||||||
handshake_pad_min: 8,
|
handshake_pad_min: 8,
|
||||||
handshake_pad_max: 32,
|
handshake_pad_max: 32,
|
||||||
|
mtu: 1400,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue