rx: Remove surplus call to FindPeer
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 13 Apr 2012 18:14:44 +0000 (19:14 +0100)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 16 Apr 2012 15:58:19 +0000 (08:58 -0700)
commita3ff62857cb76e403c11a27a250aa3c79d66ebb6
tree2a71d535856e60527481717f6cfc70ef2e0a0cda
parent660720d1f54a867e21f78b6ec4c024235e4c37b7
rx: Remove surplus call to FindPeer

When stats are enabled, rxi_ReadPacket calls FindPeer immediately
the packet is received from the wire. The peer structure that it
gets is used solely to increment a counter, and then thrown away.
Given that FindPeer requires a lock, and a hash lookup, this is
really inefficent.

Instead, delay the compilation of statistics until rxi_ReceivePacket.
Call FindPeer for version and debug packets which have no associated
connection otherwise wait until we have found the packet's connection,
and use the peer which is linked from there.

Change-Id: Ic2eb08e52b97d6b033b9d3de59da9346e012d70d
Reviewed-on: http://gerrit.openafs.org/7206
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
src/rx/rx.c
src/rx/rx_packet.c