IPC: remove fd from poll loop in the disconnect

Until now we have been relying on getting a POLLHUP, but
under heavy load we seem to get an old poll event
that cause a double deref of the connection object.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-01-03 13:48:14 +11:00
parent c3eb1be7ed
commit fa70ec98e8

View File

@ -499,6 +499,7 @@ qb_ipcs_disconnect(struct qb_ipcs_connection *c)
c->state = QB_IPCS_CONNECTION_INACTIVE;
c->service->stats.closed_connections++;
if (c->service->needs_sock_for_poll && c->setup.u.us.sock > 0) {
(void)c->service->poll_fns.dispatch_del(c->setup.u.us.sock);
qb_ipcc_us_sock_close(c->setup.u.us.sock);
c->setup.u.us.sock = -1;
qb_ipcs_connection_unref(c);
@ -510,6 +511,7 @@ qb_ipcs_disconnect(struct qb_ipcs_connection *c)
c->service->stats.closed_connections++;
if (c->service->needs_sock_for_poll && c->setup.u.us.sock > 0) {
(void)c->service->poll_fns.dispatch_del(c->setup.u.us.sock);
qb_ipcc_us_sock_close(c->setup.u.us.sock);
c->setup.u.us.sock = -1;
qb_ipcs_connection_unref(c);