当前位置: 首页>>代码示例>>C++>>正文


C++ TRC_DEBUG函数代码示例

本文整理汇总了C++中TRC_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ TRC_DEBUG函数的具体用法?C++ TRC_DEBUG怎么用?C++ TRC_DEBUG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TRC_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TRC_DEBUG

/// Delete the data for the specified namespace and key.  Writes the data
/// unconditionally, so CAS is not needed.
Store::Status BaseMemcachedStore::delete_data(const std::string& table,
                                              const std::string& key,
                                              SAS::TrailId trail)
{
  TRC_DEBUG("Deleting key %s from table %s", key.c_str(), table.c_str());

  // Construct the fully qualified key.
  std::string fqkey = table + "\\\\" + key;

  // Delete from the read replicas - read replicas are a superset of the write replicas
  const std::vector<memcached_st*>& replicas = get_replicas(fqkey, Op::READ);
  TRC_DEBUG("Deleting from the %d read replicas for key %s", replicas.size(), fqkey.c_str());

  if (_tombstone_lifetime == 0)
  {
    delete_without_tombstone(fqkey, replicas, trail);
  }
  else
  {
    delete_with_tombstone(fqkey, replicas, trail);
  }

  return Status::OK;
}
开发者ID:mash0304,项目名称:cpp-common,代码行数:26,代码来源:memcachedstore.cpp

示例2: TRC_DEBUG

// Generate a WWW-Authenticate header. This has the format:
// WWW-Authenticate: Digest realm="<home domain>",
//                          qop="auth",
//                          nonce="<nonce>",
//                          opaque="<opaque>",
//                          [stale=TRUE]
void HTTPDigestAuthenticate::generate_www_auth_header(std::string& www_auth_header, bool include_stale, AuthStore::Digest* digest)
{
  www_auth_header = "Digest";
  www_auth_header.append(" realm=\"").append(_home_domain).append("\"");
  www_auth_header.append(",qop=\"").append("auth").append("\"");
  www_auth_header.append(",nonce=\"").append(digest->_nonce).append("\"");
  www_auth_header.append(",opaque=\"").append(digest->_opaque).append("\"");

  if (include_stale)
  {
    www_auth_header.append(",stale=TRUE");
  }

  TRC_DEBUG("WWW-Authenticate header generated: %s", www_auth_header.c_str());

  TRC_DEBUG("Raising correlating marker with opaque value = %s",
            digest->_opaque.c_str());
  SAS::Marker corr(_trail, MARKED_ID_GENERIC_CORRELATOR, 0);
  corr.add_var_param(digest->_opaque);

  // The marker should be trace-scoped, and should not reactivate any trail
  // groups
  SAS::report_marker(corr, SAS::Marker::Scope::Trace, false);
}
开发者ID:AiprNick,项目名称:memento,代码行数:30,代码来源:httpdigestauthenticate.cpp

示例3: TRC_DEBUG

ConnectionTracker::~ConnectionTracker()
{
  for (std::map<pjsip_transport *, pjsip_tp_state_listener_key *>::iterator 
                                             it = _connection_listeners.begin();
       it != _connection_listeners.end();
       ++it)
  {
    TRC_DEBUG("Stop listening on connection %p", it->first);
    pjsip_transport_remove_state_listener(it->first,
                                          it->second,
                                          (void *)this);
  }

  pthread_mutex_destroy(&_lock);
}
开发者ID:AiprNick,项目名称:sprout,代码行数:15,代码来源:connection_tracker.cpp

示例4: create_key

SessionStore::Session* SessionStore::get_session_data(const std::string& call_id,
        const role_of_node_t role,
        const node_functionality_t function,
        SAS::TrailId trail)
{
    std::string key = create_key(call_id, role, function);
    TRC_DEBUG("Retrieving session data for %s", key.c_str());
    Session* session = NULL;

    std::string data;
    uint64_t cas;
    Store::Status status = _store->get_data("session", key, data, cas, trail);

    if (status == Store::Status::OK && !data.empty())
    {
        // Retrieved the data, so deserialize it.
        TRC_DEBUG("Retrieved record, CAS = %ld", cas);
        session = deserialize_session(data);

        if (session != NULL)
        {
            session->_cas = cas;
        }
        else
        {
            // Could not deserialize the record. Treat it as not found.
            TRC_INFO("Failed to deserialize record");
            SAS::Event event(trail, SASEvent::SESSION_DESERIALIZATION_FAILED, 0);
            event.add_var_param(call_id);
            event.add_var_param(data);
            SAS::report_event(event);
        }
    }

    return session;
}
开发者ID:AiprNick,项目名称:ralf,代码行数:36,代码来源:sessionstore.cpp

示例5: TRC_DEBUG

void BaseResolver::untested(const AddrInfo& ai)
{
  std::string ai_str = ai.to_string();
  TRC_DEBUG("%s returned untested", ai_str.c_str());

  pthread_mutex_lock(&_hosts_lock);
  Hosts::iterator i = _hosts.find(ai);

  if (i != _hosts.end())
  {
    i->second.untested(pthread_self());
  }

  pthread_mutex_unlock(&_hosts_lock);
}
开发者ID:ClearwaterCore,项目名称:cpp-common,代码行数:15,代码来源:baseresolver.cpp

示例6: TRC_DEBUG

std::vector<std::string> SubscriberManager::subscriptions_to_remove(const Bindings& orig_bindings,
                                                                    const Subscriptions& orig_subscriptions,
                                                                    const Bindings& bindings_to_update,
                                                                    const std::vector<std::string> binding_ids_to_remove)
{
  std::vector<std::string> subscription_ids_to_remove;
  std::set<std::string> missing_uris;

  // Store off the contact URIs of bindings to be removed. Any subscriptions
  // sharing any of these contact URIs will be removed.
  for (std::string binding_id : binding_ids_to_remove)
  {
    Bindings::const_iterator b = orig_bindings.find(binding_id);
    if (b != orig_bindings.end())
    {
      missing_uris.insert(b->second->_uri);
    }
  }

  // Store off the original contact URI of bindings where the contact is about
  // to be changed. Any subscriptions that share any of the original contact
  // URIs will be removed.
  for (BindingPair bp : bindings_to_update)
  {
    Bindings::const_iterator b = orig_bindings.find(bp.first);
    if ((b != orig_bindings.end()) &&
        (b->second->_uri != bp.second->_uri))
    {
      missing_uris.insert(b->second->_uri);
    }
  }

  // Loop over the subscriptions. If any have the same contact as one of the
  // missing URIs, the subscription should be removed.
  for (SubscriptionPair sp : orig_subscriptions)
  {
    if (missing_uris.find(sp.second->_req_uri) != missing_uris.end())
    {
      TRC_DEBUG("Subscription %s is being removed because the binding that shares"
                " its contact URI %s is being removed or changing contact URI",
                sp.first.c_str(),
                sp.second->_req_uri.c_str());
      subscription_ids_to_remove.push_back(sp.first);
    }
  }

  return subscription_ids_to_remove;
}
开发者ID:Metaswitch,项目名称:sprout,代码行数:48,代码来源:subscriber_manager.cpp

示例7: event

void BaseMemcachedStore::delete_with_tombstone(const std::string& fqkey,
                                               const std::vector<memcached_st*>& replicas,
                                               SAS::TrailId trail)
{
  if (trail != 0)
  {
    SAS::Event event(trail, SASEvent::MEMCACHED_DELETE, 0);
    event.add_var_param(fqkey);
    event.add_static_param(_tombstone_lifetime);
    SAS::report_event(event);
  }

  const char* key_ptr = fqkey.data();
  const size_t key_len = fqkey.length();

  // Calculate a timestamp (least-significant 32 bits of milliseconds since the
  // epoch) for the current time.  We store this in the flags field to allow us
  // to resolve conflicts when resynchronizing between memcached servers.
  struct timespec ts;
  (void)clock_gettime(CLOCK_REALTIME, &ts);
  uint32_t flags = (uint32_t)((ts.tv_sec * 1000) + (ts.tv_nsec / 1000000));

  // Calculate the vbucket for this key.
  int vbucket = vbucket_for_key(fqkey);

  for (size_t ii = 0; ii < replicas.size(); ++ii)
  {
    TRC_DEBUG("Attempt write tombstone to replica %d (connection %p)",
              ii,
              replicas[ii]);

    memcached_return_t rc = memcached_set_vb(replicas[ii],
                                             key_ptr,
                                             key_len,
                                             _binary ? vbucket : 0,
                                             TOMBSTONE.data(),
                                             TOMBSTONE.length(),
                                             _tombstone_lifetime,
                                             flags);

    if (!memcached_success(rc))
    {
      log_delete_failure(fqkey, ii, replicas.size(), trail, 1);
    }
  }
}
开发者ID:mash0304,项目名称:cpp-common,代码行数:46,代码来源:memcachedstore.cpp

示例8: TRC_DEBUG

void DNSEnumService::parse_naptr_reply(const struct ares_naptr_reply* naptr_reply,
                                       std::vector<DNSEnumService::Rule>& rules)
{
  for (const struct ares_naptr_reply* record = naptr_reply; record != NULL; record = record->next)
  {
    TRC_DEBUG("Got NAPTR record: %u %u \"%s\" \"%s\" \"%s\" %s", record->order, record->preference, record->service, record->flags, record->regexp, record->replacement);
    if ((strcasecmp((char*)record->service, "e2u+sip") == 0) ||
        (strcasecmp((char*)record->service, "e2u+pstn:sip") == 0) || 
        (strcasecmp((char*)record->service, "e2u+pstn:tel") == 0))
    {
      boost::regex regex;
      std::string replace;
      bool terminal = false;

      if (!EnumService::parse_regex_replace(std::string((char*)record->regexp), regex, replace))
      {
        TRC_WARNING("DNS ENUM record contains unparseable regular expression: %s", record->regexp);
        // As above, we don't give up totally here.
        continue;
      }

      // The only valid flag is u.  If we see any other flags, we must ignore
      // the whole record (according to RFC 3761, 2.4.1).
      if (strcasecmp((char*)record->flags, "u") == 0)
      {
        terminal = true;
      }
      else if (strcmp((char*)record->flags, "") != 0)
      {
        TRC_WARNING("DNS ENUM record contains unknown flags: %s", record->flags);
        // Note that we don't give up totally here.  If we end up with an empty
        // list, we'll break out then.  Otherwise, we'll just try and push on.
        continue;
      }

      rules.push_back(Rule(regex,
                           replace,
                           terminal,
                           record->order,
                           record->preference));
    }
  }
  std::sort(rules.begin(), rules.end(), DNSEnumService::Rule::compare_order_preference);
}
开发者ID:AiprNick,项目名称:sprout,代码行数:44,代码来源:enumservice.cpp

示例9: TRC_DEBUG

/// Performs an HSS LIR query.
int ICSCFLIRouter::hss_query()
{
  int status_code = PJSIP_SC_OK;

  // If we've already done one query we must force the HSS to return
  // capabilities this time.
  std::string auth_type = (_hss_rsp.scscf.empty()) ? "" : "CAPAB";

  TRC_DEBUG("Perform LIR - impu %s, originating %s, auth_type %s",
            _impu.c_str(),
            (_originating) ? "true" : "false",
            (auth_type != "") ? auth_type.c_str() : "None");
  rapidjson::Document* rsp = NULL;
  HTTPCode rc =_hss->get_location_data(_impu,
                                       _originating,
                                       auth_type,
                                       rsp,
                                       _trail);

  if (rc == HTTP_NOT_FOUND)
  {
    // HSS returned not found, so reject the request with a 404.
    status_code = PJSIP_SC_NOT_FOUND;
  }
  else if ((rc != HTTP_OK) ||
           (rsp == NULL))
  {
    // HSS failed to respond or responded with invalid data, so reject the
    // request with a 480.
    // LCOV_EXCL_START
    status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE;
    // LCOV_EXCL_STOP
  }
  else
  {
    // HSS returned a well-formed response, so parse it.
    status_code = parse_hss_response(rsp, auth_type == "CAPAB");
  }

  delete rsp;

  return status_code;
}
开发者ID:gfraysse,项目名称:sprout,代码行数:44,代码来源:icscfrouter.cpp

示例10: accumulate_internal

  void accumulate_internal(CurrentAndPrevious<ContinuousStatistics>& data, uint32_t sample)
  {
    struct timespec now;
    clock_gettime(CLOCK_REALTIME_COARSE, &now);

    ContinuousStatistics* current_data = data.get_current(now);

    TRC_DEBUG("Accumulating sample %uui into continuous accumulator statistic", sample);

    current_data->count++;

    // Compute the updated sum and sqsum based on the previous values, dependent on
    // how long since an update happened. Additionally update the sum of squares as a
    // rolling total, and update the time of the last update. Also maintain a
    // current value held, that can be used if the period ends.

    uint64_t time_since_last_update = ((now.tv_sec * 1000) + (now.tv_nsec / 1000000))
                                     - (current_data->time_last_update_ms.load());
    uint32_t current_value = current_data->current_value.load();

    current_data->time_last_update_ms = (now.tv_sec * 1000) + (now.tv_nsec / 1000000);
    current_data->sum += current_value * time_since_last_update;
    current_data->sqsum += current_value * current_value * time_since_last_update;
    current_data->current_value = sample;

    // Update the low- and high-water marks.  In each case, we get the current
    // value, decide whether a change is required and then atomically swap it
    // if so, repeating if it was changed in the meantime.  Note that
    // compare_exchange_weak loads the current value into the expected value
    // parameter (lwm or hwm below) if the compare fails.
    uint_fast64_t lwm = current_data->lwm.load();
    while ((sample < lwm) &&
           (!current_data->lwm.compare_exchange_weak(lwm, sample)))
    {
      // Do nothing.
    }
    uint_fast64_t hwm = current_data->hwm.load();
    while ((sample > hwm) &&
           (!current_data->hwm.compare_exchange_weak(hwm, sample)))
    {
      // Do nothing.
    }
  };
开发者ID:ClearwaterCore,项目名称:cpp-common,代码行数:43,代码来源:snmp_continuous_accumulator_table.cpp

示例11: create_and_add_rows

  /// Add rows to the table for a given string index (one row per time period
  /// that we are tracking.
  void create_and_add_rows(std::string string_index)
  {
    // This is going to mutate the maps so get the write lock first.
    pthread_rwlock_wrlock(&_table_lock);

    // Check that the rows don't already exist.  We only call this function if
    // the rows don't exist, but it's possible that they've been added
    // inbetween us checking that they don't exist and getting the write lock.
    if (_five_second.count(string_index) != 0)
    {
      // The rows already exist.  We don't release the RW lock until we've
      // completely finished adding all the rows so existence in the 5s map
      // means that all the rows are fully created.  Just return.
      TRC_DEBUG("Tried to add new rows but another thread beat us to it");
      pthread_rwlock_unlock(&_table_lock);
      return;
    }

    // Create CurrentAndPrevious views of EventStatisticAccumulator to
    // accumulate statistics for these rows at each of 5s and 5m scopes.
    _five_second[string_index] = new CurrentAndPrevious<EventStatisticAccumulator>(5000);
    _five_minute[string_index] = new CurrentAndPrevious<EventStatisticAccumulator>(300000);

    // Now add the actual rows to the table, referencing the
    // EventStatisticAccumulator views we've just created.  Note that we create
    // the rows with an abitrary internal key (using a _table_rows counter to
    // generate unique keys) as we don't need to be able to look them up again
    // in future.  We don't need this because we don't currently support
    // removing rows from the table.  If we need to add this in future then we
    // would need to start keying the rows off a tuple of string index and time
    // scope.
    this->add(_table_rows++, new TimeAndStringBasedEventRow(TimePeriodIndexes::scopePrevious5SecondPeriod,
                                    string_index,
                                    new TimeAndStringBasedEventRow::PreviousView((_five_second)[string_index])));
    this->add(_table_rows++, new TimeAndStringBasedEventRow(TimePeriodIndexes::scopeCurrent5MinutePeriod,
                                    string_index,
                                    new TimeAndStringBasedEventRow::CurrentView((_five_minute)[string_index])));
    this->add(_table_rows++, new TimeAndStringBasedEventRow(TimePeriodIndexes::scopePrevious5MinutePeriod,
                                    string_index,
                                    new TimeAndStringBasedEventRow::PreviousView((_five_minute)[string_index])));

    pthread_rwlock_unlock(&_table_lock);
  }
开发者ID:Metaswitch,项目名称:cpp-common,代码行数:45,代码来源:snmp_time_and_string_based_event_table.cpp

示例12: BaseResolver

SIPResolver::SIPResolver(DnsCachedResolver* dns_client,
                         int blacklist_duration) :
  BaseResolver(dns_client)
{
  TRC_DEBUG("Creating SIP resolver");

  // Create the NAPTR cache.
  std::map<std::string, int> naptr_services;
  naptr_services["SIP+D2U"] = IPPROTO_UDP;
  naptr_services["SIP+D2T"] = IPPROTO_TCP;
  create_naptr_cache(naptr_services);

  // Create the SRV cache.
  create_srv_cache();

  // Create the blacklist.
  create_blacklist(blacklist_duration);

  TRC_STATUS("Created SIP resolver");
}
开发者ID:holm-xie,项目名称:sprout,代码行数:20,代码来源:sipresolver.cpp

示例13: TRC_DEBUG

// Pop a specific timer, if required pass the timer on to the replication layer to
// reset the timer for another pop, otherwise destroy the timer record.
void TimerHandler::pop(Timer* timer)
{
  // Tombstones are reaped when they pop.
  if (timer->is_tombstone())
  {
    TRC_DEBUG("Discarding expired tombstone");
    delete timer;
    timer = NULL;
    return;
  }

  // Increment the timer's sequence before sending the callback.
  timer->sequence_number++;

  // Update the timer in case it has out of date configuration
  timer->update_cluster_information();

  // The callback borrows of the timer at this point.
  _callback->perform(timer); timer = NULL;
}
开发者ID:prio,项目名称:chronos,代码行数:22,代码来源:timer_handler.cpp

示例14: sas_log_tx_msg

static void sas_log_tx_msg(pjsip_tx_data *tdata)
{
  // For outgoing messages always use the trail identified in the module data
  SAS::TrailId trail = get_trail(tdata);

  if (trail == DONT_LOG_TO_SAS)
  {
    TRC_DEBUG("Skipping SAS logging for OPTIONS response");
    return;
  }
  else if (trail != 0)
  {
    // Raise SAS markers on initial requests only - responses in the same
    // transaction will have the same trail ID so don't need additional markers
    if (tdata->msg->type == PJSIP_REQUEST_MSG)
    {
      PJUtils::report_sas_to_from_markers(trail, tdata->msg);

      PJUtils::mark_sas_call_branch_ids(trail, NULL, tdata->msg);
    }

    // Log the message event.
    SAS::Event event(trail, SASEvent::TX_SIP_MSG, 0);
    event.add_static_param(pjsip_transport_get_type_from_flag(tdata->tp_info.transport->flag));
    event.add_static_param(tdata->tp_info.dst_port);
    event.add_var_param(tdata->tp_info.dst_name);
    event.add_compressed_param((int)(tdata->buf.cur - tdata->buf.start),
                               tdata->buf.start,
                               &SASEvent::PROFILE_SIP);
    SAS::report_event(event);
  }
  else
  {
    TRC_ERROR("Transmitting message with no SAS trail identifier\n%.*s",
              (int)(tdata->buf.cur - tdata->buf.start),
              tdata->buf.start);
  }
}
开发者ID:ClearwaterCore,项目名称:sprout,代码行数:38,代码来源:common_sip_processing.cpp

示例15: serialize_digest

Store::Status AuthStore::set_digest(const std::string& impi,
                                    const std::string& nonce,
                                    const AuthStore::Digest* digest,
                                    SAS::TrailId trail)
{
  std::string key = impi + '\\' + nonce;
  std::string data = serialize_digest(digest);

  TRC_DEBUG("Set digest for %s\n%s", key.c_str(), data.c_str());

  Store::Status status = _data_store->set_data("AuthStore",
                                               key,
                                               data,
                                               digest->_cas,
                                               _expiry,
                                               trail);

  if (status != Store::Status::OK)
  {
    // LCOV_EXCL_START - Store used in UTs doesn't fail
    TRC_ERROR("Failed to write digest for key %s", key.c_str());

    SAS::Event event(trail, SASEvent::AUTHSTORE_SET_FAILURE, 0);
    event.add_var_param(key);
    event.add_var_param(data);
    SAS::report_event(event);
    // LCOV_EXCL_STOP
  }
  else
  {
    SAS::Event event(trail, SASEvent::AUTHSTORE_SET_SUCCESS, 0);
    event.add_var_param(key);
    event.add_var_param(data);
    SAS::report_event(event);
  }

  return status;
}
开发者ID:Metaswitch,项目名称:memento,代码行数:38,代码来源:authstore.cpp


注:本文中的TRC_DEBUG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。