From 3ef47cdfd2ab5aa4f6bf60b61e37f0da7d0d6487 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Fri, 14 Feb 2003 01:14:10 +0000 Subject: [PATCH] avoid-client-connection-mismatches-20030213 Avoid asymmetry between rx connections and clients, such that one points at the other but the other doesn't point at the first one. This can sometimes happen with hosts that change addresses/ports. --- src/viced/host.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/viced/host.c b/src/viced/host.c index d8d43111d..209a0067e 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -1283,7 +1283,7 @@ ticket name length != 64 h_Hold_r(client->host); if (client->prfail != 2) { /* Could add shared lock on client here */ /* note that we don't have to lock entry in this path to - * ensure CPS is initialized, since we don't call rxr_SetSpecific + * ensure CPS is initialized, since we don't call rx_SetSpecific * until initialization is done, and we only get here if * rx_GetSpecific located the client structure. */ @@ -1352,6 +1352,16 @@ ticket name length != 64 if (client->tcon && (client->tcon != tcon)) { ViceLog(0, ("*** Vid=%d, sid=%x, tcon=%x, Tcon=%x ***\n", client->ViceId, client->sid, client->tcon, tcon)); + oldClient = (struct client *) rx_GetSpecific(client->tcon, + rxcon_client_key); + if (oldClient) { + if (oldClient == client) + rx_SetSpecific(client->tcon, rxcon_client_key, NULL); + else + ViceLog(0, + ("Client-conn mismatch: CL1=%x, CN=%x, CL2=%x\n", + client, client->tcon, oldClient)); + } client->tcon = (struct rx_connection *)0; } client->refCount++; @@ -1435,7 +1445,8 @@ ticket name length != 64 * required). So, before setting the RPC's rock, we should disconnect * the RPC from the other client structure's rock. */ - if ((oldClient = (struct client *) rx_GetSpecific(tcon, rxcon_client_key))) { + oldClient = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); + if (oldClient && oldClient->tcon == tcon) { oldClient->tcon = (struct rx_connection *) 0; /* rx_SetSpecific will be done immediately below */ } -- 2.39.5