seat: Allow new clients when active is pending ack
New clients could only be added to a VT bound seat if there were no "active" client, regardless of its actual state. This meant that if one switched from an "active" VT to an "inactive" VT, the seat would be blocked while the "active" client was in CLIENT_PENDING_DISABLE, causing new clients to possibly fail should the old client take its time with the ack. Instead, allow new clients to also be added if there is an active client whose state is CLIENT_PENDING_DISABLE, and there is no client with the new VT as its session ID.
This commit is contained in:
parent
29a6832ca0
commit
60c370d4ec
1 changed files with 13 additions and 1 deletions
14
seatd/seat.c
14
seatd/seat.c
|
@ -129,7 +129,8 @@ int seat_add_client(struct seat *seat, struct client *client) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (seat->vt_bound && seat->active_client != NULL) {
|
||||
if (seat->vt_bound && seat->active_client != NULL &&
|
||||
seat->active_client->state != CLIENT_PENDING_DISABLE) {
|
||||
log_error("Could not add client: seat is VT-bound and has an active client");
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
|
@ -148,6 +149,17 @@ int seat_add_client(struct seat *seat, struct client *client) {
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (seat->active_client != NULL) {
|
||||
for (struct linked_list *elem = seat->clients.next; elem != &seat->clients;
|
||||
elem = elem->next) {
|
||||
struct client *client = (struct client *)elem;
|
||||
if (client->session == seat->cur_vt) {
|
||||
log_error("Could not add client: seat is VT-bound and already has pending client");
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
client->session = seat->cur_vt;
|
||||
} else {
|
||||
client->session = seat->session_cnt++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue