Beispiel #1
0
    /** A peer has connected successfully
        This is called after the peer handshake has been completed and during
        peer activation. At this point, the peer address and the public key
        are known.
    */
    void onPeerActivated (Peer::ref peer)
    {
        // First assign this peer a new short ID
        peer->setShortId(++m_nextShortId);

        std::lock_guard <decltype(m_mutex)> lock (m_mutex);

        // Now track this peer
        std::pair<PeerByShortId::iterator, bool> idResult(
            m_shortIdMap.emplace (
                boost::unordered::piecewise_construct,
                boost::make_tuple (peer->getShortId()),
                boost::make_tuple (peer)));
        check_postcondition(idResult.second);

        std::pair<PeerByPublicKey::iterator, bool> keyResult(
            m_publicKeyMap.emplace (
                boost::unordered::piecewise_construct,
                boost::make_tuple (peer->getNodePublic()),
                boost::make_tuple (peer)));
        check_postcondition(keyResult.second);

        m_journal.debug << 
            "activated " << peer->getRemoteAddress() <<
            " (" << peer->getShortId() << 
            ":" << RipplePublicKey(peer->getNodePublic()) << ")";

        // We just accepted this peer so we have non-zero active peers
        check_postcondition(size() != 0);
    }
Beispiel #2
0
void summarizer_bwt::inline_summaries(const function_namet &function_name, 
				   local_SSAt &SSA, 
			           const summaryt &old_summary,
				   const exprt &postcondition,
				   bool context_sensitive,
                                   bool sufficient)
{
  for(local_SSAt::nodest::const_iterator n_it = SSA.nodes.end();
      n_it != SSA.nodes.begin(); )
  {
    n_it--;

    for(local_SSAt::nodet::function_callst::const_iterator f_it = 
	  n_it->function_calls.begin();
        f_it != n_it->function_calls.end(); f_it++)
    {
      assert(f_it->function().id()==ID_symbol); //no function pointers
      if(!sufficient && 
	 !check_call_reachable(function_name,SSA,n_it,f_it,postcondition,false))
      {
	continue;
      }

      if(!check_postcondition(function_name,SSA,n_it,f_it,
			     postcondition,context_sensitive))
      {
	exprt postcondition_call = true_exprt();
	if(context_sensitive) 
	  postcondition_call = compute_calling_context2(
	    function_name,SSA,old_summary,n_it,f_it,postcondition,sufficient);

	irep_idt fname = to_symbol_expr(f_it->function()).get_identifier();
	status() << "Recursively summarizing function " << fname << eom;
	compute_summary_rec(fname,postcondition_call,context_sensitive);
	summaries_used++;
      }
    }
  }
}