mirror of
https://github.com/n0-computer/noq.git
synced 2026-10-03 12:40:46 +00:00
Add cid len check to enable multipath
This commit is contained in:
@@ -1437,9 +1437,9 @@ impl Connection {
|
||||
/// Multipath is only enabled after the handshake is completed and if it was negotiated
|
||||
/// by both peers.
|
||||
pub fn is_multipath_enabled(&self) -> bool {
|
||||
// TODO(flub): Multipath can only be enabled if both sides use non-zero length CIDs.
|
||||
// Also check that.
|
||||
!self.is_handshaking()
|
||||
&& self.handshake_cid.len() > 0
|
||||
&& self.rem_handshake_cid.len() > 0
|
||||
&& self.config.initial_max_path_id.is_some()
|
||||
&& self.peer_params.initial_max_path_id.is_some()
|
||||
}
|
||||
|
||||
@@ -98,6 +98,10 @@ impl ConnectionId {
|
||||
res
|
||||
}
|
||||
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
self.len as usize
|
||||
}
|
||||
|
||||
/// Decode from long header format
|
||||
pub(crate) fn decode_long(buf: &mut impl Buf) -> Option<Self> {
|
||||
let len = buf.get::<u8>().ok()? as usize;
|
||||
|
||||
Reference in New Issue
Block a user