From 4f35fbb68005579f626d021632e899301f551c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist-=C3=85strand?= Date: Tue, 18 Mar 2003 03:54:51 +0000 Subject: [PATCH] viced-vbusy-when-getclient-fails-20030317 more paranoia to not crash if GetClient fails, since there's apparently a race we haven't found yet --- src/viced/host.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/viced/host.c b/src/viced/host.c index 36d718e5bb..e77d8b2b08 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -1509,6 +1509,19 @@ int GetClient(struct rx_connection * tcon, struct client **cp) H_LOCK *cp = client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); + if (client == NULL || client->tcon == NULL) { + ViceLog(0, ("GetClient: no client in conn %x (host %x), VBUSYING\n", + tcon, rx_HostOf(rx_PeerOf(tcon)))); + H_UNLOCK + return VBUSY; + } + if (rxr_CidOf(client->tcon) != client->sid) { + ViceLog(0, ("GetClient: tcon %x tcon sid %d client sid %d\n", + client->tcon, rxr_CidOf(client->tcon), + client->sid)); + H_UNLOCK + return VBUSY; + } if (!(client && client->tcon && rxr_CidOf(client->tcon) == client->sid)) { if (!client) ViceLog(0, ("GetClient: no client in conn %x\n", tcon));