NSIS-ka
A free C++ implementation of NSIS protocols

Changeset 4426


Ignore:
Timestamp:
Sep 21, 2009, 4:22:28 PM (8 years ago)
Author:
stud-lenk
Message:

Implement some sort of "2nd chance" algorithm for purging multicast peers.

If a Querying Node receives a response from a multicast peer it saves a number "response_miss_allow_count" for this peer containing the number of responses the peer is allowed to fail to send. If the number of missing responses exceeds this number, the peer will get purged from the multicast peer list.

On every receipt of a response from a multicast peer, the initial value of response_miss_allow_count is calculated by the formula: {{{

retry_limit

response_miss_allow_count = floor( ---------------------------------- )

min_peer_rsv_time + retry_period

}}}
This allows the unresponsive peer to reply late for approximately as long as it would been allowed for a unicast peer.

Location:
ntlp/branches/20090723-multicast/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ntlp/branches/20090723-multicast/src/ntlp_statemodule_querier.cpp

    r4420 r4426  
    407407    {
    408408      // multicast specific handling of responses
    409       r_entry->add_multicast_peer(sii_handle);
    410       DLog(param.name, "Saved NLI in list of multicast peers, SII handle = " << sii_handle);
    411       r_entry->set_peer_nli(NULL);
    412       r_entry->set_sii_handle(0);
    413409      if (peer_nli) {
    414410        r_entry->trim_peer_rs_validity_time(peer_nli->get_rs_validity_time());
     
    418414        ERRCLog(param.name, "incoming_pdu has no NLI. There is something really wrong!");
    419415      }
     416      r_entry->add_multicast_peer(sii_handle);
     417      DLog(param.name, "Saved NLI in list of multicast peers, SII handle = " << sii_handle);
     418      r_entry->set_peer_nli(NULL);
     419      r_entry->set_sii_handle(0);
    420420
    421421      uint32 remaining_responses_time = r_entry->get_remaining_response_time();
  • ntlp/branches/20090723-multicast/src/routingentry.cpp

    r4420 r4426  
    8989    // This multicast peer is a new one, so add it to the list
    9090    multicast_peerstatus status;
    91     status.active = true;
     91    status.response_miss_allow_count = get_max_response_miss_count();
    9292    multicast_peer[sii_handle] = status;
    93     DLog("MulticastQN", "Multicast peer with SII " << sii_handle << " added and marked active");
     93    DLog("MulticastQN", "Multicast peer with SII " << sii_handle << " added and marked active (allowed to miss "
     94                        << status.response_miss_allow_count << " responses)");
    9495  } else {
    9596    // this is a known multicast peer -- just re-activate it
    96     it->second.active = true;
     97    it->second.response_miss_allow_count = get_max_response_miss_count();
    9798    DLog("MulticastQN", "Multicast peer with SII " << sii_handle << " marked active");
    9899  }
     
    106107  for (it=multicast_peer.begin(); it != multicast_peer.end(); it++)
    107108  {
    108     it->second.active = false;
    109     DLog("MulticastQN", "Multicast peer with SII " << (*it).first << " marked inactive");
     109    it->second.response_miss_allow_count--;
    110110  }
    111111}
     
    124124  for (it=multicast_peer.begin(); it != multicast_peer.end(); it++)
    125125  {
    126     if (it->second.active == false) {
     126    if (it->second.response_miss_allow_count <= 0) {
    127127      purged_peer_count++;
    128128      multicast_peer.erase(it);
     
    135135      // Do we need to do a networknotification() to NSLP???
    136136
     137    } else {
     138      DLog("MulticastQN", "Multicast peer with SII " << it->first << " is allowed to miss "
     139                          << it->second.response_miss_allow_count << " responses without being purged");
    137140    }
    138141  }
     
    175178  return remaining_time;
    176179}
     180
     181// returns the number of missed responses a multicast peer is allowed
     182// before being purged from the multicast peer list
     183uint32
     184routingentry::get_max_response_miss_count() const
     185{
     186  unsigned int miss_count = 0;
     187  uint32 min_peer_rsv_time = get_min_peer_rs_validity_time();
     188  if (min_peer_rsv_time == 0) min_peer_rsv_time = gconf.getpar<uint32>(gistconf_rs_validity_time);
     189  do {
     190    miss_count++;
     191  } while (miss_count * (min_peer_rsv_time + get_retry_period()) < get_retry_limit());
     192  return miss_count;
     193}
  • ntlp/branches/20090723-multicast/src/routingentry.h

    r4420 r4426  
    120120
    121121struct multicast_peerstatus {
    122   bool active;
     122  uint32 response_miss_allow_count;
    123123};
    124124
     
    338338        // save_no_response_deadline() and returns the remaining time (ms)
    339339        uint32 get_remaining_response_time();
     340
     341        // returns the number of missed responses a multicast peer is allowed
     342        // before being purged from the multicast peer list
     343        uint32 get_max_response_miss_count() const;
    340344
    341345  /// enqueued DATA PAYLOAD
Note: See TracChangeset for help on using the changeset viewer.