-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
I'm trying to set up a secondary channel through which I can transfer Senders/Receivers/SharedMemory. Since the secondary channel has been created in a single process, both its server and client named pipe have the same PID. When the secondary channel's pipe handle gets transferred to the other process (via DuplicateHandle), the PID for its server end isn't updated. When another handle (e.g., from a shared memory blob) is now sent over the connection, the transfer will fail on the other end, as the PID encoded in the OutOfBand message is wrong (and the handle hasn't been duplicated into the receiver's process).
- The code for getting the server PID is here
- The PID check on the receiver side is here
- Windows' pipefs behavior of setting server/client PID at pipe creation time is documented here
Pseudocode of what I'm trying to do at the sender's side:
let sender: IpcSender<Requests> = IpcSender::connect(server_name).unwrap();
let (secondary_sender, secondary_sender_other_end) = channel<SecondaryRequests>().unwrap();
sender.send(Requests::Init(secondary_sender)).unwrap();
let shared_memory = IpcSharedMemory::from_byte(0xba, 1024 * 1024);
// The next command will fail on the receiver side, because the server PID of the secondary OsIpcSender is wrong (still the one of the current process, not the transferred OsIpcReceiver)
secondary_sender.send(SecondaryRequests::Mem(shared_memory)).unwrap();
Metadata
Metadata
Assignees
Labels
No labels