mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-18 09:15:37 +00:00
WIP: issue per-path CIDs and keep track of them
This commit is contained in:
@@ -228,8 +228,10 @@ pub struct Connection {
|
||||
/// exist. So if multipath is supported the number of paths here will be higher than
|
||||
/// the actual number of paths in use.
|
||||
rem_cids: BTreeMap<PathId, CidQueue>,
|
||||
// Attributes of CIDs generated by local peer
|
||||
local_cid_state: CidState,
|
||||
/// Attributes of CIDs generated by local endpoint
|
||||
local_cid_state: BTreeMap<PathId, CidState>,
|
||||
/// A map from issued CIDs to PathId, for fast lookup.
|
||||
path_cids: BTreeMap<ConnectionId, PathId>,
|
||||
/// State of the unreliable datagram extension
|
||||
datagrams: DatagramState,
|
||||
/// Connection level statistics
|
||||
@@ -242,11 +244,6 @@ pub struct Connection {
|
||||
//
|
||||
/// [`PathId`] associated with this connection if any.
|
||||
path_id: Option<PathId>,
|
||||
|
||||
/// A temporary map between CID and PathID.
|
||||
// TODO(flub): This will probably be stored somewhere more cohesive with other path
|
||||
// data. But is useful now because it allows us to make the logic changes.
|
||||
path_cids: BTreeMap<ConnectionId, PathId>,
|
||||
}
|
||||
|
||||
impl Connection {
|
||||
@@ -289,18 +286,22 @@ impl Connection {
|
||||
expected_token: Bytes::new(),
|
||||
client_hello: None,
|
||||
});
|
||||
let local_cid_state = BTreeMap::from([(
|
||||
PathId(0),
|
||||
CidState::new(
|
||||
cid_gen.cid_len(),
|
||||
cid_gen.cid_lifetime(),
|
||||
now,
|
||||
if pref_addr_cid.is_some() { 2 } else { 1 },
|
||||
),
|
||||
)]);
|
||||
|
||||
let mut this = Self {
|
||||
endpoint_config,
|
||||
crypto,
|
||||
handshake_cid: loc_cid,
|
||||
rem_handshake_cid: rem_cid,
|
||||
local_cid_state: CidState::new(
|
||||
cid_gen.cid_len(),
|
||||
cid_gen.cid_lifetime(),
|
||||
now,
|
||||
if pref_addr_cid.is_some() { 2 } else { 1 },
|
||||
),
|
||||
local_cid_state,
|
||||
path: PathData::new(remote, allow_mtud, None, now, path_validated, &config),
|
||||
allow_mtud,
|
||||
local_ip,
|
||||
|
||||
Reference in New Issue
Block a user