mirror of
https://github.com/chirpstack/chirpstack.git
synced 2024-12-19 05:07:54 +00:00
Revert "Revert to 2018 edition to support older Rust versions."
This reverts commit ad49c29592
.
Some dependencies require 2021 edition.
This commit is contained in:
parent
58b74dbf1f
commit
a9a3c35797
3
.gitignore
vendored
3
.gitignore
vendored
@ -17,6 +17,3 @@
|
||||
|
||||
# API
|
||||
/api/js/node_modules
|
||||
|
||||
# Bitbake recipes
|
||||
*.bb
|
||||
|
@ -1,10 +1,9 @@
|
||||
[package]
|
||||
name = "chirpstack"
|
||||
description = "ChirpStack is an open-source LoRaWAN(TM) Network Server"
|
||||
repository="https://github.com/chirpstack/chirpstack/"
|
||||
version = "4.0.0-test.1"
|
||||
authors = ["Orne Brocaar <info@brocaar.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "MIT"
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::str::FromStr;
|
||||
use std::time::SystemTime;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::str::FromStr;
|
||||
use std::time::SystemTime;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
use std::convert::TryInto;
|
||||
use std::ops::Add;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
use anyhow::Result;
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
|
@ -1,4 +1,3 @@
|
||||
use std::convert::TryInto;
|
||||
use std::io::Cursor;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
@ -1,4 +1,3 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
@ -341,7 +341,6 @@ pub async fn enqueue(
|
||||
qi: MulticastGroupQueueItem,
|
||||
gateway_ids: &[EUI64],
|
||||
) -> Result<(Vec<Uuid>, u32), Error> {
|
||||
let mg_id = qi.multicast_group_id;
|
||||
let (ids, f_cnt) = task::spawn_blocking({
|
||||
let gateway_ids = gateway_ids.to_vec();
|
||||
move || -> Result<(Vec<Uuid>, u32), Error> {
|
||||
@ -504,7 +503,7 @@ pub async fn enqueue(
|
||||
}
|
||||
})
|
||||
.await??;
|
||||
info!(multicast_group_id = %mg_id, f_cnt = f_cnt, "Multicast-group queue item created");
|
||||
info!(multicast_group_id = %qi.multicast_group_id, f_cnt = f_cnt, "Multicast-group queue item created");
|
||||
Ok((ids, f_cnt))
|
||||
}
|
||||
|
||||
|
@ -1421,25 +1421,21 @@ async fn test_lorawan_10_uplink() {
|
||||
Test {
|
||||
name: "uplink of class-c device sets lock".into(),
|
||||
device_queue_items: vec![],
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.supports_class_c = true;
|
||||
device_profile::update(dp.clone()).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.supports_class_c = false;
|
||||
device_profile::update(dp).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
device_session: Some(ds.clone()),
|
||||
tx_info: tx_info.clone(),
|
||||
@ -2016,25 +2012,21 @@ async fn test_lorawan_10_mac_commands() {
|
||||
Test {
|
||||
name: "unconfirmed uplink + device-status request downlink (FOpts)".into(),
|
||||
device_queue_items: vec![],
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.device_status_req_interval = 1;
|
||||
device_profile::update(dp.clone()).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.device_status_req_interval = 0;
|
||||
device_profile::update(dp.clone()).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
device_session: Some(ds.clone()),
|
||||
tx_info: tx_info.clone(),
|
||||
@ -2118,25 +2110,21 @@ async fn test_lorawan_10_mac_commands() {
|
||||
data: vec![1, 2, 3, 4],
|
||||
..Default::default()
|
||||
}],
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.device_status_req_interval = 1;
|
||||
device_profile::update(dp.clone()).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.device_status_req_interval = 0;
|
||||
device_profile::update(dp.clone()).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
device_session: Some(ds.clone()),
|
||||
tx_info: tx_info.clone(),
|
||||
@ -3682,9 +3670,8 @@ async fn test_lorawan_10_adr() {
|
||||
Test {
|
||||
name: "acknowledgement of pending adr request".into(),
|
||||
device_queue_items: vec![],
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
mac_command::set_pending(
|
||||
&dev_eui,
|
||||
@ -3707,7 +3694,6 @@ async fn test_lorawan_10_adr() {
|
||||
.await
|
||||
.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
device_session: Some(ds.clone()),
|
||||
@ -3751,9 +3737,8 @@ async fn test_lorawan_10_adr() {
|
||||
Test {
|
||||
name: "negative acknowledgement of pending adr request".into(),
|
||||
device_queue_items: vec![],
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
mac_command::set_pending(
|
||||
&dev_eui,
|
||||
@ -3776,7 +3761,6 @@ async fn test_lorawan_10_adr() {
|
||||
.await
|
||||
.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
device_session: Some(ds.clone()),
|
||||
@ -3994,9 +3978,8 @@ async fn test_lorawan_10_adr() {
|
||||
Test {
|
||||
name: "new channel re-configuration ack-ed".into(),
|
||||
device_queue_items: vec![],
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
mac_command::set_pending(
|
||||
&dev_eui,
|
||||
@ -4019,7 +4002,6 @@ async fn test_lorawan_10_adr() {
|
||||
.await
|
||||
.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
device_session: Some(ds_7chan.clone()),
|
||||
@ -4061,9 +4043,8 @@ async fn test_lorawan_10_adr() {
|
||||
Test {
|
||||
name: "new channel re-configuration not ack-ed".into(),
|
||||
device_queue_items: vec![],
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
mac_command::set_pending(
|
||||
&dev_eui,
|
||||
@ -4086,7 +4067,6 @@ async fn test_lorawan_10_adr() {
|
||||
.await
|
||||
.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
device_session: Some(ds_7chan.clone()),
|
||||
|
@ -150,13 +150,11 @@ async fn test_gateway_filtering() {
|
||||
let tests = vec![
|
||||
Test {
|
||||
name: "private gateway of same tenant".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
rx_info: rx_info_a.clone(),
|
||||
@ -196,13 +194,11 @@ async fn test_gateway_filtering() {
|
||||
},
|
||||
Test {
|
||||
name: "private gateway other tenant".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
rx_info: rx_info_b.clone(),
|
||||
@ -387,13 +383,11 @@ async fn test_lorawan_10() {
|
||||
},
|
||||
Test {
|
||||
name: "join-request accepted".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
rx_info: rx_info.clone(),
|
||||
@ -573,9 +567,8 @@ async fn test_lorawan_10() {
|
||||
},
|
||||
Test {
|
||||
name: "join-request accepted + skip fcnt check".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
|
||||
@ -583,17 +576,14 @@ async fn test_lorawan_10() {
|
||||
dev.skip_fcnt_check = true;
|
||||
let _ = device::update(dev).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dev = device::get(&dev_eui).await.unwrap();
|
||||
dev.skip_fcnt_check = false;
|
||||
let _ = device::update(dev).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
rx_info: rx_info.clone(),
|
||||
tx_info: tx_info.clone(),
|
||||
@ -633,13 +623,11 @@ async fn test_lorawan_10() {
|
||||
},
|
||||
Test {
|
||||
name: "join-request accepted + cflist".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
rx_info: rx_info.clone(),
|
||||
@ -787,10 +775,9 @@ async fn test_lorawan_10() {
|
||||
},
|
||||
Test {
|
||||
name: "join-request accepted + class-b supported".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
|
||||
@ -798,17 +785,14 @@ async fn test_lorawan_10() {
|
||||
dp.supports_class_b = true;
|
||||
let _ = device_profile::update(dp).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.supports_class_b = false;
|
||||
let _ = device_profile::update(dp).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
rx_info: rx_info.clone(),
|
||||
tx_info: tx_info.clone(),
|
||||
@ -818,10 +802,9 @@ async fn test_lorawan_10() {
|
||||
},
|
||||
Test {
|
||||
name: "join-request accepted + class-c supported".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
|
||||
@ -829,17 +812,14 @@ async fn test_lorawan_10() {
|
||||
dp.supports_class_c = true;
|
||||
let _ = device_profile::update(dp).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.supports_class_c = false;
|
||||
let _ = device_profile::update(dp).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
rx_info: rx_info.clone(),
|
||||
tx_info: tx_info.clone(),
|
||||
@ -849,9 +829,8 @@ async fn test_lorawan_10() {
|
||||
},
|
||||
Test {
|
||||
name: "device disabled".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
|
||||
@ -859,17 +838,14 @@ async fn test_lorawan_10() {
|
||||
dev.is_disabled = true;
|
||||
let _ = device::update(dev).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dev = device::get(&dev_eui).await.unwrap();
|
||||
dev.is_disabled = false;
|
||||
let _ = device::update(dev).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
rx_info: rx_info.clone(),
|
||||
tx_info: tx_info.clone(),
|
||||
@ -1022,13 +998,11 @@ async fn test_lorawan_11() {
|
||||
},
|
||||
Test {
|
||||
name: "join-request accepted".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: None,
|
||||
rx_info: rx_info.clone(),
|
||||
@ -1203,10 +1177,9 @@ async fn test_lorawan_11() {
|
||||
},
|
||||
Test {
|
||||
name: "join-request accepted + class-c supported".into(),
|
||||
before_func: Some(Box::new({
|
||||
before_func: Some(Box::new(move || {
|
||||
let dev_eui = dev.dev_eui.clone();
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
device_keys::reset_nonces(&dev_eui).await.unwrap();
|
||||
|
||||
@ -1214,17 +1187,14 @@ async fn test_lorawan_11() {
|
||||
dp.supports_class_c = true;
|
||||
let _ = device_profile::update(dp).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
after_func: Some(Box::new({
|
||||
after_func: Some(Box::new(move || {
|
||||
let dp_id = dp.id.clone();
|
||||
move || {
|
||||
Box::pin(async move {
|
||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||
dp.supports_class_c = false;
|
||||
let _ = device_profile::update(dp).await.unwrap();
|
||||
})
|
||||
}
|
||||
})),
|
||||
rx_info: rx_info.clone(),
|
||||
tx_info: tx_info.clone(),
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use chrono::{DateTime, Duration, Local, Utc};
|
||||
|
@ -1,4 +1,3 @@
|
||||
use std::convert::TryInto;
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use anyhow::Result;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
Loading…
Reference in New Issue
Block a user