Exemplo n.º 1
0
void bud_context_rotate_cb(uv_timer_t* timer) {
  bud_error_t err;
  bud_context_t* context;
  bud_config_t* config;
  int r;
  uint32_t index;

  context = (bud_context_t*) timer->data;
  config = context->config;

  /* No rotation in workers */
  if (config->is_worker)
    return;

  r = RAND_bytes((unsigned char*) context->ticket_key_storage,
                 sizeof(context->ticket_key_storage));
  ASSERT(r == 1, "Failed to randomize new TLS Ticket Key");

  index = context - config->contexts;

  err = bud_config_set_ticket_raw(config,
                                  index,
                                  sizeof(context->ticket_key_storage),
                                  context->ticket_key_storage);
  if (!bud_is_ok(err))
    bud_error_log(config, kBudLogWarning, err);
}
Exemplo n.º 2
0
void bud_worker_signal_cb(uv_signal_t* signal, int status) {
    bud_config_t* config;
    bud_error_t err;

    config = signal->data;
    if (status == UV_ECANCELED)
        return;

    err = bud_config_reload(config);
    if (bud_is_ok(err))
        bud_log(config, kBudLogInfo, "Successfully reloaded config");
    else
        bud_error_log(config, kBudLogWarning, err);
}