Skip to content
Closed
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
2 changes: 2 additions & 0 deletions litebox/src/broker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ mod tests {
) -> core::result::Result<Option<BrokerHandshakeResponse>, Self::Error> {
Ok(Some(BrokerHandshakeResponse::Negotiated {
broker_protocol_version: BROKER_PROTOCOL_VERSION,
capabilities: litebox_broker_protocol::BrokerCapabilities::NONE,
}))
}
}
Expand Down Expand Up @@ -812,6 +813,7 @@ mod tests {
) -> core::result::Result<Option<BrokerHandshakeResponse>, Self::Error> {
Ok(Some(BrokerHandshakeResponse::Negotiated {
broker_protocol_version: BROKER_PROTOCOL_VERSION,
capabilities: litebox_broker_protocol::BrokerCapabilities::NONE,
}))
}
}
Expand Down
1 change: 1 addition & 0 deletions litebox/src/event/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ mod tests {
) -> core::result::Result<Option<BrokerHandshakeResponse>, Self::Error> {
Ok(Some(BrokerHandshakeResponse::Negotiated {
broker_protocol_version: litebox_broker_protocol::BROKER_PROTOCOL_VERSION,
capabilities: litebox_broker_protocol::BrokerCapabilities::NONE,
}))
}
}
Expand Down
7 changes: 4 additions & 3 deletions litebox/src/fs/in_mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,17 @@ impl<Platform: sync::RawSyncPrimitivesProvider> FileSystem<Platform> {
///
/// This function primarily exists to initialize files. Most regular interaction with the file
/// system should be done without this function.
pub fn with_root_privileges<F>(&mut self, f: F)
pub fn with_root_privileges<F, R>(&mut self, f: F) -> R
where
F: FnOnce(&mut Self),
F: FnOnce(&mut Self) -> R,
{
let original_user = core::mem::replace(&mut self.current_user, UserInfo::ROOT);
f(self);
let result = f(self);
let root_again = core::mem::replace(&mut self.current_user, original_user);
if root_again.user != UserInfo::ROOT.user || root_again.group != UserInfo::ROOT.group {
unreachable!()
}
result
}

/// Initialize a primarily read-heavy file with static data.
Expand Down
1 change: 1 addition & 0 deletions litebox/src/pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,7 @@ mod tests {
) -> core::result::Result<Option<BrokerHandshakeResponse>, Self::Error> {
Ok(Some(BrokerHandshakeResponse::Negotiated {
broker_protocol_version: BROKER_PROTOCOL_VERSION,
capabilities: litebox_broker_protocol::BrokerCapabilities::NONE,
}))
}
}
Expand Down
6 changes: 6 additions & 0 deletions litebox_broker_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ impl BrokerCore {
self.limits
}

/// Returns the immutable capabilities of this core's socket provider.
#[must_use]
pub fn capabilities(&self) -> litebox_broker_protocol::BrokerCapabilities {
self.socket_provider.capabilities()
}

pub(crate) fn allocate_reference_handle(&self) -> Result<ObjectHandle> {
let mut next_reference_handle = self.next_reference_handle.write();
let handle = ObjectHandle(*next_reference_handle);
Expand Down
Loading