MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / _configure_fwd_limit_req

Method _configure_fwd_limit_req

chirpstack/src/downlink/data.rs:1827–1879  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

1825 }
1826
1827 async fn _configure_fwd_limit_req(&mut self) -> Result<()> {
1828 trace!("Configuring Relay Fwd Limit");
1829
1830 let ds = self.device.get_device_session_mut()?;
1831 let relay_params = self.device_profile.relay_params.clone().unwrap_or_default();
1832
1833 // Get the current relay state.
1834 let relay = if let Some(r) = &ds.relay {
1835 r.clone()
1836 } else {
1837 internal::Relay::default()
1838 };
1839
1840 if relay.join_req_limit_reload_rate != relay_params.relay_join_req_limit_reload_rate as u32
1841 || relay.notify_limit_reload_rate != relay_params.relay_notify_limit_reload_rate as u32
1842 || relay.global_uplink_limit_reload_rate
1843 != relay_params.relay_global_uplink_limit_reload_rate as u32
1844 || relay.overall_limit_reload_rate
1845 != relay_params.relay_overall_limit_reload_rate as u32
1846 || relay.join_req_limit_bucket_size
1847 != relay_params.relay_join_req_limit_bucket_size as u32
1848 || relay.notify_limit_bucket_size != relay_params.relay_notify_limit_bucket_size as u32
1849 || relay.global_uplink_limit_bucket_size
1850 != relay_params.relay_global_uplink_limit_bucket_size as u32
1851 || relay.overall_limit_bucket_size
1852 != relay_params.relay_overall_limit_bucket_size as u32
1853 {
1854 let set = lrwn::MACCommandSet::new(vec![lrwn::MACCommand::ConfigureFwdLimitReq(
1855 lrwn::ConfigureFwdLimitReqPayload {
1856 reload_rate: lrwn::FwdLimitReloadRatePL {
1857 overall_reload_rate: relay_params.relay_overall_limit_reload_rate,
1858 global_uplink_reload_rate: relay_params
1859 .relay_global_uplink_limit_reload_rate,
1860 notify_reload_rate: relay_params.relay_notify_limit_reload_rate,
1861 join_req_reload_rate: relay_params.relay_join_req_limit_reload_rate,
1862 reset_limit_counter: lrwn::ResetLimitCounter::NoChange,
1863 },
1864 load_capacity: lrwn::FwdLimitLoadCapacityPL {
1865 overall_limit_size: relay_params.relay_overall_limit_bucket_size,
1866 global_uplink_limit_size: relay_params
1867 .relay_global_uplink_limit_bucket_size,
1868 notify_limit_size: relay_params.relay_notify_limit_bucket_size,
1869 join_req_limit_size: relay_params.relay_join_req_limit_bucket_size,
1870 },
1871 },
1872 )]);
1873 self.mac_commands.push(set);
1874 }
1875
1876 ds.relay = Some(relay);
1877
1878 Ok(())
1879 }
1880
1881 async fn _update_filter_list(&mut self) -> Result<()> {
1882 trace!("Updating Relay filter list");

Callers 2

set_mac_commandsMethod · 0.80

Calls 2

pushMethod · 0.80

Tested by 1