From 85835f169cf47207795e00cbc2dae6fd77950f78 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 15 Oct 2004 07:01:35 +0000 Subject: [PATCH] rx-peer-and-conn-refcounts-now-unsigned-int32-20041015 FIXES 15459 in an extreme case, the peer object refcount could wrap we should probably also log if wrapping is imminent --- src/rx/rx.c | 7 ++++--- src/rx/rx.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index e3a68ed..c7299d8 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -817,15 +817,16 @@ rxi_CleanupConnection(struct rx_connection *conn) * idle (refCount == 0) after rx_idlePeerTime (60 seconds) have passed. */ MUTEX_ENTER(&rx_peerHashTable_lock); - if (--conn->peer->refCount <= 0) { + if (conn->peer->refCount < 2) { conn->peer->idleWhen = clock_Sec(); - if (conn->peer->refCount < 0) { - conn->peer->refCount = 0; + if (conn->peer->refCount < 1) { + conn->peer->refCount = 1; MUTEX_ENTER(&rx_stats_mutex); rxi_lowPeerRefCount++; MUTEX_EXIT(&rx_stats_mutex); } } + conn->peer->refCount--; MUTEX_EXIT(&rx_peerHashTable_lock); MUTEX_ENTER(&rx_stats_mutex); diff --git a/src/rx/rx.h b/src/rx/rx.h index c948c90..6778bbc 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -250,7 +250,7 @@ struct rx_connection { /* client-- to retransmit the challenge */ struct rx_service *service; /* used by servers only */ u_short serviceId; /* To stamp on requests (clients only) */ - u_short refCount; /* Reference count */ + afs_uint32 refCount; /* Reference count */ u_char flags; /* Defined below */ u_char type; /* Type of connection, defined below */ u_char secondsUntilPing; /* how often to ping for each active call */ @@ -365,7 +365,7 @@ struct rx_peer { /* For garbage collection */ afs_uint32 idleWhen; /* When the refcountwent to zero */ - short refCount; /* Reference count for this structure */ + afs_uint32 refCount; /* Reference count for this structure */ /* Congestion control parameters */ u_char burstSize; /* Reinitialization size for the burst parameter */ -- 1.9.4