| Input: The relevant parameters, such as: query message number, network topology model, network size, TTL (Time-to-Live) |
| Output: Result (success or fail), the hops number of the first success return message, message information |
| Peer gets a query message |
| If ( |
| If ( hits at ) then {// the requested objects are included in |
| ; |
| Peer sends successful to along with the reverse . } |
| Else if () then {// the requested objects are not included in |
| ; |
| Peer sends failure to along with the reverse . } |
| Else if () {// the query is familiar query |
| return in ; |
| calculates the value of each corresponding neighbor node of the row in |
| according to formula (6) and then gets the value according to formula (10); selects the |
| neighbor node with higher credibility value and forwards to ; updates |
| . } |
| Else { //, the query is strange query |
| calculates the credibility value of each neighbor node according to formula (11) and selects the neighbor |
| node with higher credibility value and forwards to ; adds the requested object and to |
| and , respectively. } |
| End if } |
| Else if (){//Updates the corresponding information in , and |
| If ( and ) then {returns in. . } |
| Else ; returns in . } |
| End if |
| Peer |
| If ( and ) then {returns in . } |
| Else ; returns in . } |
| End if |
| If () then ; . } |
| Else ; updates according to formula (9). } |
| End if |
| Peer sends to along with the reverse . } |
| Else { //, deletes the corresponding information in , and |
| Peer |
| If ( and ) { |
| returns in and in ; |
| updates ; |
| If () then { |
| in CQM; |
| For (to ) do End for |
| If ( ) then End if |
| For ( to ) do End for |
| If ( ) then End if } |
| End if } |
| End if |
| End if. |