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

Changeset 4223


Ignore:
Timestamp:
Aug 11, 2009, 1:32:09 PM (8 years ago)
Author:
bless
Message:
  • printout of routing table entry now also lists the key
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ntlp/trunk/src/routingtable.cpp

    r4210 r4223  
    284284
    285285  ma_entry* ma_p = NULL;
     286  bool found= false;
    286287  ma_iter cur = ma_table.find(*nlikey);
    287288  if (cur != ma_table.end())
     
    290291    if (ma_p)
    291292    {
     293      found= true;
    292294      DLog(classname, "Found MA for given NLI, peer address:" << ma_p->get_peer_address() << " state:" << ma_p->get_state_name());
    293295      // check state of MA
     
    306308  else
    307309  {
    308     DLog(classname, "MA not found / not usable");
    309     return NULL;
     310          if (nlikey->get_pi())
     311                  DLog(classname, "MA " << (!found ? "not found" : "not usable")
     312                       << "for NLI " << *(nlikey->get_pi()) << ", IP:" << nlikey->get_if_address().get_ip_str() );
     313          else
     314                  DLog(classname, "MA " << (!found ? "not found" : "not usable")
     315                       << " for NLI <NO PeerID!>, IP:" << nlikey->get_if_address().get_ip_str() );
     316
     317
     318          return NULL;
    310319  }
    311320}
     
    607616  DLog(classname, "Deleted Routing Key w/ Session-ID "<< ((key->sid) ? key->sid->to_string() : "NULL") );
    608617
    609   // delete entry in routing table
     618  // delete entry in routing table, note that this will probably make the iterator invalid
    610619  rtable.erase(it);
    611620  status();
     
    667676  ostringstream os;
    668677
    669   const routingentry* entry;
     678  const routingentry* entry= NULL;
     679 
    670680  rt_citer entryit= rtable.begin();
    671681  while(entryit !=rtable.end())
     
    673683    if ( (entry= (*entryit).second) != NULL )
    674684    {
    675       os << entry->to_string() << "\n";
     685
     686            const routingkey& rkey= (*entryit).first;
     687            os << "sid:" << (rkey.sid ? rkey.sid->to_string() : "-")
     688               << " NSLPID:" << rkey.nslpid << endl << " MRI/Flow:" << (rkey.mr ? rkey.mr->to_string() : "NULL") << endl;
     689
     690            os << entry->to_string() << endl << "---------------------------------------------" << endl;
    676691    }
    677692    entryit++;
     
    967982              // XXX: after removing the entry from the table the iterator is no longer valid!
    968983              //      starting from the begining again, though this is not 100% correct, as the
    969               //      cur++ at the bottom will make us start from begining+1
     984              //      cur++ at the bottom will make us start from beginning+1
    970985              //      It seems unlikely, however, that we have more than one match in a hash_map
    971986              //      so this whole while-loop is probably bogus anyway.  For the moment this is
    972987              //      good enough.
    973988              cur = rtable.begin();
     989
    974990              add(key, tmpentry);
    975991              if (entry) delete entry;
     
    10711087        } // end if TENTATIVE
    10721088
    1073 
    1074 
    10751089      }
    10761090      else
Note: See TracChangeset for help on using the changeset viewer.