Commit dc2030f9 authored by nanamicat's avatar nanamicat

BTreeMap

parent 397993e1
Pipeline #41974 passed with stages
in 2 minutes and 14 seconds
......@@ -7,10 +7,11 @@ use anyhow::{Context, Result};
use crossbeam::epoch::{pin, Owned};
use crossbeam_utils::thread;
use itertools::Itertools;
use std::collections::BTreeMap;
use std::net::Shutdown;
use std::sync::atomic::Ordering;
use std::time::Duration;
use std::{collections::HashMap, env, mem::MaybeUninit};
use std::{env, mem::MaybeUninit};
fn main() -> Result<()> {
println!("Starting");
......@@ -21,14 +22,14 @@ fn main() -> Result<()> {
.into_iter()
.sorted_by_key(|r| r.remote_id)
.map(|c| Router::new(c).map(|router| (router.config.remote_id, router)))
.collect::<Result<HashMap<u8, Router>, _>>()?;
.collect::<Result<BTreeMap<u8, Router>, _>>()?;
for (_, group) in &routers
.values()
.filter(|r| r.config.schema == Schema::UDP && r.config.src_port != 0)
.chunk_by(|r| r.config.src_port)
{
Router::attach_filter_udp(group.sorted_by_key(|r| r.config.remote_id).collect())?;
Router::attach_filter_udp(group.collect())?;
}
println!("created tuns");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment