mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-04-25 05:20:07 +00:00
Fix clippy warnings.
This commit is contained in:
parent
a433c7dd14
commit
050610de55
@ -272,7 +272,6 @@ impl DeviceService for Device {
|
|||||||
} else {
|
} else {
|
||||||
Some(req.search.to_string())
|
Some(req.search.to_string())
|
||||||
},
|
},
|
||||||
..Default::default()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let count = device::get_count(&filters).await.map_err(|e| e.status())?;
|
let count = device::get_count(&filters).await.map_err(|e| e.status())?;
|
||||||
|
@ -1358,7 +1358,7 @@ impl Data {
|
|||||||
15,
|
15,
|
||||||
0,
|
0,
|
||||||
&relay::DeviceFilters {
|
&relay::DeviceFilters {
|
||||||
relay_dev_eui: Some(self.device.dev_eui.clone()),
|
relay_dev_eui: Some(self.device.dev_eui),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@ -1367,11 +1367,9 @@ impl Data {
|
|||||||
// This way we can combine the delete + add by just overwriting an old slot.
|
// This way we can combine the delete + add by just overwriting an old slot.
|
||||||
let relay_devices_dev_euis: Vec<Vec<u8>> =
|
let relay_devices_dev_euis: Vec<Vec<u8>> =
|
||||||
relay_devices.iter().map(|d| d.dev_eui.to_vec()).collect();
|
relay_devices.iter().map(|d| d.dev_eui.to_vec()).collect();
|
||||||
relay.devices = relay
|
relay
|
||||||
.devices
|
.devices
|
||||||
.into_iter()
|
.retain(|rd| relay_devices_dev_euis.contains(&rd.dev_eui));
|
||||||
.filter(|rd| relay_devices_dev_euis.contains(&rd.dev_eui))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
// Calculate free slots.
|
// Calculate free slots.
|
||||||
// If we need to add a device, we can use the first slot available.
|
// If we need to add a device, we can use the first slot available.
|
||||||
@ -1423,9 +1421,9 @@ impl Data {
|
|||||||
reload_rate: device.relay_ed_uplink_limit_reload_rate
|
reload_rate: device.relay_ed_uplink_limit_reload_rate
|
||||||
as u8,
|
as u8,
|
||||||
},
|
},
|
||||||
dev_addr: dev_addr,
|
dev_addr,
|
||||||
w_fcnt: ds.relay.map(|v| v.w_f_cnt).unwrap_or(0),
|
w_fcnt: ds.relay.map(|v| v.w_f_cnt).unwrap_or(0),
|
||||||
root_wor_s_key: root_wor_s_key,
|
root_wor_s_key,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
@ -1479,9 +1477,9 @@ impl Data {
|
|||||||
bucket_size: device.relay_ed_uplink_limit_bucket_size as u8,
|
bucket_size: device.relay_ed_uplink_limit_bucket_size as u8,
|
||||||
reload_rate: device.relay_ed_uplink_limit_reload_rate as u8,
|
reload_rate: device.relay_ed_uplink_limit_reload_rate as u8,
|
||||||
},
|
},
|
||||||
dev_addr: dev_addr,
|
dev_addr,
|
||||||
w_fcnt: ds.relay.map(|v| v.w_f_cnt).unwrap_or(0),
|
w_fcnt: ds.relay.map(|v| v.w_f_cnt).unwrap_or(0),
|
||||||
root_wor_s_key: root_wor_s_key,
|
root_wor_s_key,
|
||||||
},
|
},
|
||||||
)]);
|
)]);
|
||||||
mac_command::set_pending(
|
mac_command::set_pending(
|
||||||
@ -1541,20 +1539,19 @@ impl Data {
|
|||||||
< Utc::now()
|
< Utc::now()
|
||||||
.checked_sub_signed(chrono::Duration::hours(24))
|
.checked_sub_signed(chrono::Duration::hours(24))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
&& counter < max_count
|
||||||
{
|
{
|
||||||
if counter < max_count {
|
counter += 1;
|
||||||
counter += 1;
|
commands.push(lrwn::MACCommand::CtrlUplinkListReq(
|
||||||
commands.push(lrwn::MACCommand::CtrlUplinkListReq(
|
lrwn::CtrlUplinkListReqPayload {
|
||||||
lrwn::CtrlUplinkListReqPayload {
|
ctrl_uplink_action: lrwn::CtrlUplinkActionPL {
|
||||||
ctrl_uplink_action: lrwn::CtrlUplinkActionPL {
|
uplink_list_idx: rd.index as u8,
|
||||||
uplink_list_idx: rd.index as u8,
|
ctrl_uplink_action: 0,
|
||||||
ctrl_uplink_action: 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
));
|
},
|
||||||
|
));
|
||||||
|
|
||||||
rd.w_f_cnt_last_request = Some(Utc::now().into());
|
rd.w_f_cnt_last_request = Some(Utc::now().into());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
@ -1667,7 +1664,7 @@ impl Data {
|
|||||||
15,
|
15,
|
||||||
0,
|
0,
|
||||||
&relay::DeviceFilters {
|
&relay::DeviceFilters {
|
||||||
relay_dev_eui: Some(self.device.dev_eui.clone()),
|
relay_dev_eui: Some(self.device.dev_eui),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@ -1677,11 +1674,9 @@ impl Data {
|
|||||||
// Note that index 0 has a special meaning.
|
// Note that index 0 has a special meaning.
|
||||||
let relay_devices_dev_euis: Vec<Vec<u8>> =
|
let relay_devices_dev_euis: Vec<Vec<u8>> =
|
||||||
relay_devices.iter().map(|d| d.dev_eui.to_vec()).collect();
|
relay_devices.iter().map(|d| d.dev_eui.to_vec()).collect();
|
||||||
relay.filters = relay
|
relay
|
||||||
.filters
|
.filters
|
||||||
.into_iter()
|
.retain(|f| f.index == 0 || relay_devices_dev_euis.contains(&f.dev_eui));
|
||||||
.filter(|f| f.index == 0 || relay_devices_dev_euis.contains(&f.dev_eui))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
// Calculate free slots.
|
// Calculate free slots.
|
||||||
// Note that the first slot is used as "catch-all" filter.
|
// Note that the first slot is used as "catch-all" filter.
|
||||||
|
@ -119,7 +119,7 @@ async fn main() -> Result<()> {
|
|||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
Some(Commands::CreateApiKey { name }) => cmd::create_api_key::run(&name).await?,
|
Some(Commands::CreateApiKey { name }) => cmd::create_api_key::run(name).await?,
|
||||||
None => cmd::root::run().await?,
|
None => cmd::root::run().await?,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,8 +381,7 @@ impl JoinRequest {
|
|||||||
|
|
||||||
fn abort_on_relay_only_comm(&self) -> Result<(), Error> {
|
fn abort_on_relay_only_comm(&self) -> Result<(), Error> {
|
||||||
// In case the relay context is not set and relay_ed_relay_only is set, abort.
|
// In case the relay context is not set and relay_ed_relay_only is set, abort.
|
||||||
if !self.relay_context.is_some()
|
if self.relay_context.is_none() && self.device_profile.as_ref().unwrap().relay_ed_relay_only
|
||||||
&& self.device_profile.as_ref().unwrap().relay_ed_relay_only
|
|
||||||
{
|
{
|
||||||
warn!(dev_eui = %self.device.as_ref().unwrap().dev_eui, "Only communication through relay is allowed");
|
warn!(dev_eui = %self.device.as_ref().unwrap().dev_eui, "Only communication through relay is allowed");
|
||||||
return Err(Error::Abort);
|
return Err(Error::Abort);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user