Skip to content

Commit b25b304

Browse files
ids1024Drakulix
authored andcommitted
session: Remove NewPrivilegedClient command
pop-os/cosmic-session#154 removes the use of this command.
1 parent 0816b87 commit b25b304

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

src/session.rs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use smithay::reexports::{
66
};
77

88
use anyhow::{Context, Result, anyhow};
9-
use sendfd::RecvWithFd;
109
use serde::{Deserialize, Serialize};
1110
use std::{
1211
collections::HashMap,
@@ -15,17 +14,15 @@ use std::{
1514
io::{AsFd, BorrowedFd, FromRawFd, RawFd},
1615
net::UnixStream,
1716
},
18-
sync::Arc,
1917
};
2018
use tracing::{error, warn};
2119

22-
use crate::state::{ClientState, Common, State};
20+
use crate::state::{Common, State};
2321

2422
#[derive(Debug, Serialize, Deserialize)]
2523
#[serde(rename_all = "snake_case", tag = "message")]
2624
pub enum Message {
2725
SetEnv { variables: HashMap<String, String> },
28-
NewPrivilegedClient { count: usize },
2926
}
3027

3128
struct StreamWrapper {
@@ -102,7 +99,7 @@ pub fn setup_socket(handle: LoopHandle<State>, common: &Common) -> Result<()> {
10299

103100
handle.insert_source(
104101
Generic::new(StreamWrapper::from(session_socket), Interest::READ, Mode::Level),
105-
move |_, stream, state| {
102+
move |_, stream, _state| {
106103
// SAFETY: We don't drop the stream!
107104
let stream = unsafe { stream.get_mut() };
108105

@@ -133,32 +130,7 @@ pub fn setup_socket(handle: LoopHandle<State>, common: &Common) -> Result<()> {
133130
stream.read_bytes = 0;
134131
match std::str::from_utf8(&stream.buffer) {
135132
Ok(message) => {
136-
match serde_json::from_str::<'_, Message>(message) {
137-
Ok(Message::NewPrivilegedClient { count }) => {
138-
let mut buffer = [0; 1];
139-
let mut fds = vec![0; count];
140-
match stream.stream.recv_with_fd(&mut buffer, &mut fds) {
141-
Ok((_, received_count)) => {
142-
assert_eq!(received_count, count);
143-
for fd in fds.into_iter().take(received_count) {
144-
if fd == -1 {
145-
continue;
146-
}
147-
let stream = unsafe { UnixStream::from_raw_fd(fd) };
148-
let client_state = Arc::new(ClientState {
149-
privileged: true,
150-
..state.new_client_state()
151-
});
152-
if let Err(err) = state.common.display_handle.insert_client(stream, client_state) {
153-
warn!(?err, "Failed to add privileged client to display");
154-
}
155-
}
156-
},
157-
Err(err) => {
158-
warn!(?err, "Failed to read file descriptors from session sock");
159-
}
160-
}
161-
},
133+
match serde_json::from_str::<'_, Message>(&message) {
162134
Ok(Message::SetEnv { .. }) => warn!("Got SetEnv from session? What is this?"),
163135
_ => warn!("Unknown session socket message, are you using incompatible cosmic-session and cosmic-comp versions?"),
164136
};

0 commit comments

Comments
 (0)