コード例 #1
0
ファイル: test_timer_wheel.c プロジェクト: pzoleex/syslog-ng
static void
_test_assoc_data(TimerWheel *wheel)
{
  timer_wheel_set_associated_data(wheel, g_strdup(ASSOC_DATA_STRING), (GDestroyNotify) g_free);
  if (strcmp(timer_wheel_get_associated_data(wheel), ASSOC_DATA_STRING) != 0)
    {
      fprintf(stderr, "Associated data mismatch, found=%s, expected=%s",
              (gchar *) timer_wheel_get_associated_data(wheel), ASSOC_DATA_STRING);
      exit(1);
    }
}
コード例 #2
0
ファイル: patterndb.c プロジェクト: jszigetvari/syslog-ng
static void
pattern_db_expire_entry(TimerWheel *wheel, guint64 now, gpointer user_data)
{
  PDBContext *context = user_data;
  PatternDB *pdb = (PatternDB *) timer_wheel_get_associated_data(wheel);
  GString *buffer = g_string_sized_new(256);
  LogMessage *msg = correllation_context_get_last_message(&context->super);
  PDBProcessParams *process_params = pdb->timer_process_params;

  msg_debug("Expiring patterndb correllation context",
            evt_tag_str("last_rule", context->rule->rule_id),
            evt_tag_long("utc", timer_wheel_get_time(pdb->timer_wheel)));
  process_params->context = context;
  process_params->rule = context->rule;
  process_params->msg = msg;
  process_params->buffer = buffer;
  _execute_rule_actions(pdb, process_params, RAT_TIMEOUT);
  g_hash_table_remove(pdb->correllation.state, &context->super.key);
  g_string_free(buffer, TRUE);

  /* pdb_context_free is automatically called when returning from
     this function by the timerwheel code as a destroy notify
     callback. */
}