In order to ensure that each node is connected with one another in P2P network and strengthen the invulnerability of network topology, in this paper, topological optimization in unstructured P2P network was studied. Based on the weakest part in network---topologically-critical node, existing algorithm to search and eliminate topologically-critical nodes was analyzed and improved. The experiment results show that the improved CAM algorithm (ECAM algorithm) can greatly reduce the network consumption and communication costs and improve discovery efficiency while ensuring the discovery accuracy.