From 448a5586e9235bee9648d89e4103ed48e6237c15 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 17 May 2017 09:57:27 -0700 Subject: [PATCH] os: Don't call ospoll_listen/ospoll_mute after connection is closed In set_poll_client, check oc->trans_conn to make sure the connection is still running before changing the ospoll configuration of the file descriptor in case some other bit of the server is now using this file descriptor. Reviewed-by: Adam Jackson Signed-off-by: Keith Packard --- os/connection.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/os/connection.c b/os/connection.c index a45a252a5..07c16eacf 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1084,10 +1084,12 @@ set_poll_client(ClientPtr client) { OsCommPtr oc = (OsCommPtr) client->osPrivate; - if (listen_to_client(client)) - ospoll_listen(server_poll, oc->fd, X_NOTIFY_READ); - else - ospoll_mute(server_poll, oc->fd, X_NOTIFY_READ); + if (oc->trans_conn) { + if (listen_to_client(client)) + ospoll_listen(server_poll, oc->trans_conn->fd, X_NOTIFY_READ); + else + ospoll_mute(server_poll, oc->trans_conn->fd, X_NOTIFY_READ); + } } static void