From 9a213dba7776f9571d34c8b11416d88440ece827 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Mon, 20 Sep 2004 03:07:22 +0000 Subject: [PATCH] rx-unrefd-peer-may-be-gcd-so-be-safe-20040919 this means we potentially "lose" some received bytes in the tracking, but the alternative is to add and then drop a ref (which i suppose would be ok) --- src/rx/rx_packet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index 298cf205c..2185d43e9 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -865,7 +865,11 @@ rxi_ReadPacket(int socket, register struct rx_packet *p, afs_uint32 * host, * never be cleaned up. */ peer = rxi_FindPeer(*host, *port, 0, 0); - if (peer) { + /* Since this may not be associated with a connection, + * it may have no refCount, meaning we could race with + * ReapConnections + */ + if (peer && (peer->refCount > 0)) { MUTEX_ENTER(&peer->peer_lock); hadd32(peer->bytesReceived, p->length); MUTEX_EXIT(&peer->peer_lock); -- 2.39.5