In this paper, a new mechanism to achieve anonymity in peer-to-peer (P2P) file sharing systems is proposed. As usual, anonymity
is obtained by means of connecting the source and destination peers through a set of intermediate nodes, creating a multiple-hop
path. The main contribution of the paper is a distributed algorithm able to guarantee the anonymity even when a node in a
path fails (voluntarily or not). The algorithm takes into account the inherent costs associated with multiple-hop communications
and tries to reach a well-balanced solution between the anonymity degree and its associated costs. Some parameters are obtained
analytically but the main network performances are evaluated by simulation. We quantify the costs associated with the control
packets used by the distributed recovery algorithm. On the other hand, we also measure the anonymity provided by our system
(benefit), using a simulation-based analysis to calculate the average entropy.