示例#1
0
void RegistrationTimeoutHandler::handle_response()
{
  bool all_bindings_expired = false;
  RegStore::AoR* aor_data = set_aor_data(_cfg->_store, _aor_id, NULL, _cfg->_remote_store, true, all_bindings_expired);

  if (aor_data != NULL)
  {
    // If we have a remote store, try to store this there too.  We don't worry
    // about failures in this case.
    if (_cfg->_remote_store != NULL)
    {
      bool ignored;
      RegStore::AoR* remote_aor_data = set_aor_data(_cfg->_remote_store, _aor_id, aor_data, NULL, false, ignored);
      delete remote_aor_data;
    }

    if (all_bindings_expired)
    {
      LOG_DEBUG("All bindings have expired based on a Chronos callback - triggering deregistration at the HSS");
      _cfg->_hss->update_registration_state(_aor_id, "", HSSConnection::DEREG_TIMEOUT, 0);
    }
  }

  delete aor_data;
}
示例#2
0
HTTPCode DeregistrationHandler::handle_request()
{
  for (std::map<std::string, std::string>::iterator it=_bindings.begin(); it!=_bindings.end(); ++it)
  {
    RegStore::AoR* aor_data = set_aor_data(_cfg->_store, it->first, it->second, NULL, _cfg->_remote_store, true);

    if (aor_data != NULL)
    {
      // If we have a remote store, try to store this there too.  We don't worry
      // about failures in this case.
      if (_cfg->_remote_store != NULL)
      {
        RegStore::AoR* remote_aor_data = set_aor_data(_cfg->_remote_store, it->first, it->second, aor_data, NULL, false);
        delete remote_aor_data;
      }
    }
    else
    {
      // Can't connect to memcached, return 500. If this isn't the first AoR being edited
      // then this will lead to an inconsistency between the HSS and Sprout, as
      // Sprout will have changed some of the AoRs, but HSS will believe they all failed.
      // Sprout accepts changes to AoRs that don't exist though.
      // LCOV_EXCL_START - local store (used in testing) never fails
      LOG_WARNING("Unable to connect to memcached for AoR %s", it->first.c_str());
      delete aor_data;
      return HTTP_SERVER_ERROR;
      // LCOV_EXCL_STOP
    }

    delete aor_data;
  }

  return HTTP_OK;
}
示例#3
0
void RegistrationTimeoutTask::handle_response()
{
  bool all_bindings_expired = false;
  RegStore::AoR* aor_data = set_aor_data(_cfg->_store, _aor_id, NULL, _cfg->_remote_store, true, all_bindings_expired);

  if (aor_data != NULL)
  {
    // If we have a remote store, try to store this there too.  We don't worry
    // about failures in this case.
    if (_cfg->_remote_store != NULL)
    {
      bool ignored;
      RegStore::AoR* remote_aor_data = set_aor_data(_cfg->_remote_store, _aor_id, aor_data, NULL, false, ignored);
      delete remote_aor_data;
    }

    if (all_bindings_expired)
    {
      LOG_DEBUG("All bindings have expired based on a Chronos callback - triggering deregistration at the HSS");
      _cfg->_hss->update_registration_state(_aor_id, "", HSSConnection::DEREG_TIMEOUT, 0);
    }
  }
  else
  {
    // We couldn't update the RegStore but there is nothing else we can do to
    // recover from this.
    LOG_INFO("Could not update update RegStore on registration timeout for AoR: %s",
             _aor_id.c_str());
  }

  delete aor_data;
  report_sip_all_register_marker(trail(), _aor_id);
}
示例#4
0
bool RegStore::set_aor_data(const std::string& aor_id,
                            AoR* aor_data,
                            bool set_chronos,
                            SAS::TrailId trail)
{
  bool unused;
  return set_aor_data(aor_id, aor_data, set_chronos, trail, unused);
}