Skip to content
Merged
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
20 changes: 13 additions & 7 deletions src/ipc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,24 @@
#[cfg(feature = "services")]
{
let mut sm = service::new_named_port_object::<sm::UserInterface>()?;
match (self.is_mitm_service, self.handle_type) {
(true, WaitHandleType::Server) => {

if self.handle_type == WaitHandleType::Server {
if self.is_mitm_service {
debug_assert!(
self.info.owns_handle,
"MitM server objects should always own their handles."

Check warning on line 519 in src/ipc/server.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/nx/nx/src/ipc/server.rs
);
sm.atmosphere_uninstall_mitm(self.service_name)?;
sf::Session::from(self.mitm_forward_info).close();
}
(false, _) => sm.unregister_service(self.service_name)?,
_ => {}
};
else {
sm.unregister_service(self.service_name)?;
}
}

if self.is_mitm_service {
sf::Session::from(self.mitm_forward_info).close();
}

sm.detach_client(sf::ProcessId::new())?;
}
}
Expand Down Expand Up @@ -698,7 +704,7 @@
let mut handles_index: usize = 0;
for server_holder in &mut self.server_holders {
let server_info = server_holder.info;
if server_info.handle != 0 {
if server_info.handle != svc::INVALID_HANDLE {
self.wait_handles[handles_index] = server_info.handle;
handles_index += 1;
}
Expand Down
3 changes: 1 addition & 2 deletions src/ipc/sf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ impl<
}

impl<
const IN: bool,
const MAP_ALIAS: bool,
const POINTER: bool,
const FIXED_SIZE: bool,
Expand All @@ -344,7 +343,7 @@ impl<
>
Buffer<
'_,
IN,
true,
true,
MAP_ALIAS,
POINTER,
Expand Down
4 changes: 2 additions & 2 deletions src/ipc/sf/nfp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ pub struct DeviceHandle {
}
const_assert!(core::mem::size_of::<DeviceHandle>() == 0x8);

#[derive(Request, Response, Copy, Clone, PartialEq, Eq)]
#[derive(Request, Response, Copy, Clone, PartialEq, Eq, Debug)]
#[repr(u32)]
pub enum State {
NonInitialized = 0,
Initialized = 1,
}

#[derive(Request, Response, Copy, Clone, PartialEq, Eq)]
#[derive(Request, Response, Copy, Clone, PartialEq, Eq, Debug)]
#[repr(u32)]
pub enum DeviceState {
Initialized = 0,
Expand Down
6 changes: 3 additions & 3 deletions src/svc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ pub fn send_sync_request_light(handle: Handle) -> Result<()> {
}
}

/// Sends an IPC synchronization request to a session.
/// Sends a synchronous IPC request to a session.
#[inline(always)]
pub fn send_sync_request(handle: Handle) -> Result<()> {
unsafe {
Expand All @@ -837,7 +837,7 @@ pub fn send_sync_request(handle: Handle) -> Result<()> {
}
}

/// Sends an IPC synchronization request to a session from an user allocated buffer.
/// Sends a synchronous IPC request to a session from an user allocated buffer.
///
/// The buffer size must be a multiple of the system page size (0x1000).
#[inline(always)]
Expand All @@ -848,7 +848,7 @@ pub unsafe fn send_sync_request_with_user_data(buffer: &mut [u8], handle: Handle
}
}

/// Sends an IPC synchronization request to a session from an user allocated buffer (asynchronous version).
/// Sends an asynchronous IPC request to a session from an user allocated buffer .
///
/// The buffer size must be a multiple of the system page size (0x1000).
#[inline(always)]
Expand Down
Loading