Skip to content

Commit

Permalink
Merge pull request #309 from NordSecurity/v6.3.0_moose_v4
Browse files Browse the repository at this point in the history
v6.3.0 Old moose
  • Loading branch information
Lipt0nas authored Mar 20, 2024
2 parents 898e49b + 30e33a9 commit 9550f4f
Show file tree
Hide file tree
Showing 12 changed files with 546 additions and 33 deletions.
2 changes: 1 addition & 1 deletion MOOSE_RELEASE_TAG
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v5.0.0-libDropApp
v4.0.1-libDropApp

4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### UNRELEASED
### v6.3.0-old-moose
### **Old Moose**
---
* Add `MOOSE_RELEASE_TAG` file
* Broaden the set of illegal filename characters to encompass FAT and EXT filesystems
Expand All @@ -7,6 +8,7 @@
* Fix directories contents being merged in case their normalized name is the same
* Add `TransferPending` event emitted after successful `norddrop_download()` call
* Fix occasional sender's state is not completed and equal to the receiver's state when canceling the transfer
* Uses moose v4.0.1

---
<br>
Expand Down
12 changes: 11 additions & 1 deletion drop-analytics/src/file_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,31 @@ struct InitEvent {
#[serde(flatten)]
event: crate::InitEventData,
lib_version: String,
app_version: String,
prod: bool,
}

pub struct FileImpl {
event_path: String,
logger: Logger,
lib_version: String,
app_version: String,
prod: bool,
}

impl FileImpl {
pub fn new(logger: Logger, event_path: String, lib_version: String, prod: bool) -> Self {
pub fn new(
logger: Logger,
event_path: String,
lib_version: String,
app_version: String,
prod: bool,
) -> Self {
Self {
event_path,
logger,
lib_version,
app_version,
prod,
}
}
Expand Down Expand Up @@ -73,6 +82,7 @@ impl super::Moose for FileImpl {
let event = self.write_event(MooseEventType::Init(InitEvent {
event: data,
lib_version: self.lib_version.clone(),
app_version: self.app_version.clone(),
prod: self.prod,
}));

Expand Down
7 changes: 5 additions & 2 deletions drop-analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ fn create(
logger: Logger,
event_path: String,
lib_version: String,
app_version: String,
prod: bool,
) -> anyhow::Result<Arc<dyn Moose>> {
#[cfg(feature = "moose")]
{
let moose = moose_impl::MooseImpl::new(logger, event_path, lib_version, prod)?;
let moose = moose_impl::MooseImpl::new(logger, event_path, lib_version, app_version, prod)?;
Ok(Arc::new(moose))
}
#[cfg(feature = "moose_file")]
Expand All @@ -129,6 +130,7 @@ fn create(
logger,
event_path,
lib_version,
app_version,
prod,
)))
}
Expand All @@ -143,14 +145,15 @@ pub fn init_moose(
logger: Logger,
event_path: String,
lib_version: String,
app_version: String,
prod: bool,
) -> anyhow::Result<Arc<dyn Moose>> {
let mut lock = INSTANCE.lock().expect("Moose lock is poisoned");

if let Some(arc) = lock.as_ref().and_then(Weak::upgrade) {
Ok(arc)
} else {
let arc = create(logger, event_path, lib_version, prod)?;
let arc = create(logger, event_path, lib_version, app_version, prod)?;

*lock = Some(Arc::downgrade(&arc));

Expand Down
Loading

0 comments on commit 9550f4f

Please sign in to comment.