Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
633 changes: 419 additions & 214 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env_logger = "0"
itertools = "0"
libc = "0"
log = { version = "0", features = ["std"] }
prost = "0"
prost = "0.13"
protobuf = { git = "https://github.com/thinkparq/protobuf", rev = "24f942a79ffa8a879b84dc014384c9f06780d2b7" }
regex = "1"
ring = "0"
Expand Down
2 changes: 1 addition & 1 deletion mgmtd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sqlite_check = { path = "../sqlite_check" }

anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
daemonize = "0"
daemonize = "=0.5.0"
env_logger = { workspace = true }
itertools = { workspace = true }
libc = { workspace = true }
Expand Down
9 changes: 4 additions & 5 deletions mgmtd/src/bee_msg/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,11 @@ async fn update_node(msg: RegisterNode, ctx: &Context) -> Result<NodeId> {
None
};

if let Some(machine_uuid) = machine_uuid {
if db::node::count_machines(tx, machine_uuid, node.as_ref().map(|n| n.uid))?
if let Some(machine_uuid) = machine_uuid
&& db::node::count_machines(tx, machine_uuid, node.as_ref().map(|n| n.uid))?
>= licensed_machines
{
bail!("Licensed machine limit reached. Node registration denied.");
}
{
bail!("Licensed machine limit reached. Node registration denied.");
}

let (node, is_new) = if let Some(node) = node {
Expand Down
8 changes: 4 additions & 4 deletions mgmtd/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ generate_structs! {

impl Config {
pub fn check_validity(&self) -> Result<()> {
if let Some(ref uuid) = self.fs_uuid {
if uuid.get_version_num() != 4 {
bail!("Provided file system UUID is not a valid v4 UUID");
}
if let Some(ref uuid) = self.fs_uuid
&& uuid.get_version_num() != 4
{
bail!("Provided file system UUID is not a valid v4 UUID");
}

if self.quota_enforce && !self.quota_enable {
Expand Down
22 changes: 11 additions & 11 deletions mgmtd/src/grpc/quota.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,17 @@ pub(crate) async fn get_quota_usage(

// If this if the first entry, include the quota refresh period. Do not send it again
// after to minimize message size.
if offset == 0 {
if let Some(entry) = entries.next() {
stream
.send(pm::GetQuotaUsageResponse {
entry: Some(entry),
refresh_period_s: Some(
ctx.info.user_config.quota_update_interval.as_secs(),
),
})
.await?;
}
if offset == 0
&& let Some(entry) = entries.next()
{
stream
.send(pm::GetQuotaUsageResponse {
entry: Some(entry),
refresh_period_s: Some(
ctx.info.user_config.quota_update_interval.as_secs(),
),
})
.await?;
}

// Send all the (remaining) entries to the client
Expand Down
2 changes: 1 addition & 1 deletion mgmtd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ fn init_db(db_file: &Path, v7_path: Option<&Path>, fs_uuid: Option<Uuid>) -> Res
.parent()
.ok_or_else(|| anyhow!("File does not have a parent folder"))?,
)?;
conn.backup(rusqlite::DatabaseName::Main, db_file, None)?;
conn.backup(rusqlite::MAIN_DB, db_file, None)?;

Ok(())
})()
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.88"
channel = "1.90"
profile = "default"
10 changes: 5 additions & 5 deletions shared/src/conn/incoming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ async fn stream_loop(
.await
{
// If the error comes from the connection being closed, we only log a debug message
if let Some(inner) = err.downcast_ref::<io::Error>() {
if let ErrorKind::UnexpectedEof = inner.kind() {
log::debug!("Closed stream from {:?}: {err:#}", stream.addr());
return;
}
if let Some(inner) = err.downcast_ref::<io::Error>()
&& let ErrorKind::UnexpectedEof = inner.kind()
{
log::debug!("Closed stream from {:?}: {err:#}", stream.addr());
return;
}

log::error!(
Expand Down
8 changes: 3 additions & 5 deletions shared/src/nic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ impl NicFilter {
let mut split = input.split_whitespace().peekable();
let mut res = Self::default();

if let Some(field) = split.peek() {
if *field == "!" {
res.invert = true;
split.next();
}
if let Some(field) = split.peek() && *field == "!" {
res.invert = true;
split.next();
}

if let Some(field) = split.next() && field != "*" {
Expand Down
2 changes: 1 addition & 1 deletion sqlite/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub fn backup_db(conn: &mut rusqlite::Connection) -> Result<PathBuf> {

let backup_file = format!("{db_file}.v{version}");

conn.backup(rusqlite::DatabaseName::Main, &backup_file, None)
conn.backup(rusqlite::MAIN_DB, &backup_file, None)
.with_context(|| format!("Database backup to {backup_file} failed"))?;

Ok(PathBuf::from(backup_file))
Expand Down
Loading