pub fn new(
        worker_name: String,
        worker_id: String,
        k: Option<usize>,
        p: Option<f64>,
        q: Option<f64>,
        beacon_threshold: Option<i64>,
        wifi_tx_queue: Sender<Transmission>,
        lora_tx_queue: Sender<Transmission>,
        rng: Arc<Mutex<StdRng>>,
        logger: Logger,
    ) -> ReactiveGossipRoutingIII {
        let qt = HashMap::new();
        let d_routes = HashMap::new();
        let k_routes = HashMap::new();
        let route_cache = HashSet::new();
        let data_cache = HashMap::new();
        let pending_destinations = HashMap::new();
        let vicinity_cache = HashMap::new();
        
        let k = k.unwrap_or(DEFAULT_MIN_HOPS);
        let p = p.unwrap_or(BASE_GOSSIP_PROB);
        let q = q.unwrap_or(VICINITY_GOSSIP_PROB);
        let beacon_threshold = beacon_threshold.unwrap_or(MAINTENANCE_BEACON_THRESHOLD);
        
        let ts_data_retransmission =
            Utc::now() + Duration::milliseconds(MAINTENANCE_DATA_RETRANSMISSION);
        let ts_data_retransmission = AtomicI64::new(ts_data_retransmission.timestamp_nanos());
        let ts_rd_retransmission =
            Utc::now() + Duration::milliseconds(MAINTENANCE_RD_RETRANSMISSION);
        let ts_rd_retransmission = AtomicI64::new(ts_rd_retransmission.timestamp_nanos());
        let ts_vinicity_maintenance =
            Utc::now() + Duration::milliseconds(MAINTENANCE_VICINITY_CACHE);
        let ts_vinicity_maintenance = AtomicI64::new(ts_vinicity_maintenance.timestamp_nanos());
        let ts_last_beacon_msg = Utc::now() + Duration::milliseconds(beacon_threshold);
        let ts_last_beacon_msg = AtomicI64::new(ts_last_beacon_msg.timestamp_nanos());

        ReactiveGossipRoutingIII {
            k,
            p,
            q,
            beacon_threshold,
            worker_name,
            worker_id,
            wifi_tx_queue,
            lora_tx_queue,
            destination_routes: Arc::new(Mutex::new(d_routes)),
            queued_transmissions: Arc::new(Mutex::new(qt)),
            known_routes: Arc::new(Mutex::new(k_routes)),
            pending_destinations: Arc::new(Mutex::new(pending_destinations)),
            route_msg_cache: Arc::new(Mutex::new(route_cache)),
            data_msg_cache: Arc::new(Mutex::new(data_cache)),
            vicinity_cache: Arc::new(Mutex::new(vicinity_cache)),
            ts_data_retransmission,
            ts_rd_retransmission,
            ts_vinicity_maintenance,
            ts_last_beacon_msg,
            rng,
            logger,
        }
    }
/// Creates a new instance of the protocol.
Creates a new instance of the protocol.
Creates a new instance of the protocol .
pub fn new(
        worker_name: String,
        worker_id: String,
        k: Option<usize>,
        p: Option<f64>,
        q: Option<f64>,
        beacon_threshold: Option<i64>,
        wifi_tx_queue: Sender<Transmission>,
        lora_tx_queue: Sender<Transmission>,
        rng: Arc<Mutex<StdRng>>,
        logger: Logger,
    ) -> ReactiveGossipRoutingIII {
        let qt = HashMap::new();
        let d_routes = HashMap::new();
        let k_routes = HashMap::new();
        let route_cache = HashSet::new();
        let data_cache = HashMap::new();
        let pending_destinations = HashMap::new();
        let vicinity_cache = HashMap::new();
        let k = k.unwrap_or(DEFAULT_MIN_HOPS);
        let p = p.unwrap_or(BASE_GOSSIP_PROB);
        let q = q.unwrap_or(VICINITY_GOSSIP_PROB);
        let beacon_threshold = beacon_threshold.unwrap_or(MAINTENANCE_BEACON_THRESHOLD);
        let ts_data_retransmission =
            Utc::now() + Duration::milliseconds(MAINTENANCE_DATA_RETRANSMISSION);
        let ts_data_retransmission = AtomicI64::new(ts_data_retransmission.timestamp_nanos());
        let ts_rd_retransmission =
            Utc::now() + Duration::milliseconds(MAINTENANCE_RD_RETRANSMISSION);
        let ts_rd_retransmission = AtomicI64::new(ts_rd_retransmission.timestamp_nanos());
        let ts_vinicity_maintenance =
            Utc::now() + Duration::milliseconds(MAINTENANCE_VICINITY_CACHE);
        let ts_vinicity_maintenance = AtomicI64::new(ts_vinicity_maintenance.timestamp_nanos());
        let ts_last_beacon_msg = Utc::now() + Duration::milliseconds(beacon_threshold);
        let ts_last_beacon_msg = AtomicI64::new(ts_last_beacon_msg.timestamp_nanos());
        ReactiveGossipRoutingIII {
            k,
            p,
            q,
            beacon_threshold,
            worker_name,
            worker_id,
            wifi_tx_queue,
            lora_tx_queue,
            destination_routes: Arc::new(Mutex::new(d_routes)),
            queued_transmissions: Arc::new(Mutex::new(qt)),
            known_routes: Arc::new(Mutex::new(k_routes)),
            pending_destinations: Arc::new(Mutex::new(pending_destinations)),
            route_msg_cache: Arc::new(Mutex::new(route_cache)),
            data_msg_cache: Arc::new(Mutex::new(data_cache)),
            vicinity_cache: Arc::new(Mutex::new(vicinity_cache)),
            ts_data_retransmission,
            ts_rd_retransmission,
            ts_vinicity_maintenance,
            ts_last_beacon_msg,
            rng,
            logger,
        }
    }
pub fn new ( worker_name : String , worker_id : String , k : Option < usize > , p : Option < f64 > , q : Option < f64 > , beacon_threshold : Option < i64 > , wifi_tx_queue : Sender < Transmission > , lora_tx_queue : Sender < Transmission > , rng : Arc < Mutex < StdRng > > , logger : Logger , ) -> ReactiveGossipRoutingIII { let qt = HashMap :: new ( ) ; let d_routes = HashMap :: new ( ) ; let k_routes = HashMap :: new ( ) ; let route_cache = HashSet :: new ( ) ; let data_cache = HashMap :: new ( ) ; let pending_destinations = HashMap :: new ( ) ; let vicinity_cache = HashMap :: new ( ) ; let k = k . unwrap_or ( DEFAULT_MIN_HOPS ) ; let p = p . unwrap_or ( BASE_GOSSIP_PROB ) ; let q = q . unwrap_or ( VICINITY_GOSSIP_PROB ) ; let beacon_threshold = beacon_threshold . unwrap_or ( MAINTENANCE_BEACON_THRESHOLD ) ; let ts_data_retransmission = Utc :: now ( ) + Duration :: milliseconds ( MAINTENANCE_DATA_RETRANSMISSION ) ; let ts_data_retransmission = AtomicI64 :: new ( ts_data_retransmission . timestamp_nanos ( ) ) ; let ts_rd_retransmission = Utc :: now ( ) + Duration :: milliseconds ( MAINTENANCE_RD_RETRANSMISSION ) ; let ts_rd_retransmission = AtomicI64 :: new ( ts_rd_retransmission . timestamp_nanos ( ) ) ; let ts_vinicity_maintenance = Utc :: now ( ) + Duration :: milliseconds ( MAINTENANCE_VICINITY_CACHE ) ; let ts_vinicity_maintenance = AtomicI64 :: new ( ts_vinicity_maintenance . timestamp_nanos ( ) ) ; let ts_last_beacon_msg = Utc :: now ( ) + Duration :: milliseconds ( beacon_threshold ) ; let ts_last_beacon_msg = AtomicI64 :: new ( ts_last_beacon_msg . timestamp_nanos ( ) ) ; ReactiveGossipRoutingIII { k , p , q , beacon_threshold , worker_name , worker_id , wifi_tx_queue , lora_tx_queue , destination_routes : Arc :: new ( Mutex :: new ( d_routes ) ) , queued_transmissions : Arc :: new ( Mutex :: new ( qt ) ) , known_routes : Arc :: new ( Mutex :: new ( k_routes ) ) , pending_destinations : Arc :: new ( Mutex :: new ( pending_destinations ) ) , route_msg_cache : Arc :: new ( Mutex :: new ( route_cache ) ) , data_msg_cache : Arc :: new ( Mutex :: new ( data_cache ) ) , vicinity_cache : Arc :: new ( Mutex :: new ( vicinity_cache ) ) , ts_data_retransmission , ts_rd_retransmission , ts_vinicity_maintenance , ts_last_beacon_msg , rng , logger , } }
Creates a new instance of the protocol.
Creates a new instance of the protocol .
worker_name
String
worker_id
String
k
Option<usize>
p
Option<f64>
q
Option<f64>
beacon_threshold
Option<i64>
wifi_tx_queue
Sender<Transmission>
lora_tx_queue
Sender<Transmission>
rng
Arc<Mutex<StdRng>>
logger
Logger