Skip to content

Commit

Permalink
app_persistency: disable create flag on readonly persistency
Browse files Browse the repository at this point in the history
When reading the persistency readonly, trying to open it with the create
flag results in an error. Removed create flag on readonly persistency
  • Loading branch information
svenrademakers committed Sep 26, 2024
1 parent 8164f03 commit 1e4da23
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bmcd"
version = "2.3.3"
version = "2.3.4"
edition = "2021"
license = "Apache-2.0"
rust-version = "1.75.0"
Expand Down
2 changes: 1 addition & 1 deletion src/persistency/app_persistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl ApplicationPersistency {
let serialized_file = OpenOptions::new()
.read(true)
.write(can_write)
.create(true)
.create(can_write)
.truncate(false)
.open(&path)
.await;
Expand Down
6 changes: 3 additions & 3 deletions src/serial_service/serial_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use tokio_serial::{DataBits, Parity, SerialPortBuilderExt, StopBits};
use tokio_stream::wrappers::BroadcastStream;
use tokio_util::codec::{BytesCodec, Decoder};
use tokio_util::sync::PollSender;
use tracing::debug;
use tracing::trace;

use crate::utils::{string_from_utf16, string_from_utf32};

Expand Down Expand Up @@ -132,7 +132,7 @@ impl Handler {
};

let mut rb = self.ring_buffer.lock().await;
debug!("reading {} from node {}", rb.len(), self.node);
trace!("reading {} from node {}", rb.len(), self.node);
Ok(Bytes::copy_from_slice(rb.make_contiguous()))
}

Expand Down Expand Up @@ -205,7 +205,7 @@ impl Handler {
break;
};

debug!("writing {} bytes node {}", bytes.len(), node);
trace!("writing {} bytes node {}", bytes.len(), node);
// Implementation is actually infallible in the currently used v0.1.3
if buffer.lock().await.write(&bytes).is_err() {
tracing::error!("Failed to write to buffer of node {}", node);
Expand Down

0 comments on commit 1e4da23

Please sign in to comment.