Exemplo n.º 1
0
static void
_init_state(PatternDB *self)
{
  self->rate_limits = g_hash_table_new_full(correllation_key_hash, correllation_key_equal, NULL,
                                            (GDestroyNotify) pdb_rate_limit_free);
  correllation_state_init_instance(&self->correllation);
  self->timer_wheel = timer_wheel_new();
  timer_wheel_set_associated_data(self->timer_wheel, self, NULL);
}
Exemplo n.º 2
0
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);
    }
}