using libevent2 (libevent-2.0.21-stable) i create this log:

[warn] event_del: event has no event_base set.
[err] event_assign called on an already added event 0x84de9e4 (events: 0x0,
fd: 0, flags: 0x0)

using this code:

void connection::listen_write_event() {
  int rc = 0;
  if (fd == -1) return;
  if (is_listening_write) return;
  is_listening_write = 1;
#ifdef DEBUG
      fprintf(stderr,"%d:%08X, LISTEN WRITING\n",fd, (unsigned
int)pthread_self());
#endif
  event_del(&_sock_ev_write);
  rc = event_assign(&_sock_ev_write, s->get_evt_base(),
    fd, EV_WRITE,
    server::con_ready_pattern, this);
  if (rc == 0)
    event_add(&_sock_ev_write, NULL);
  else
    syslog( LOG_CRIT, "%d:cannot create write event",fd);
}

i cannot supress the warn even if i put an event base (probably
missunderstood the doc)

i declared
struct event_base * evt_base; as a global

and get it init:

#ifdef DEBUG
  event_enable_debug_mode();
#endif
  evthread_use_pthreads();
  gconf.evt_base = event_base_new();
  if ( gconf.evt_base == NULL ) {
    syslog( LOG_ERR, "cannot allocate base for %s:%d", gconf.ip,
gconf.port);
    return 1;
  }

then used it everywhere


to create the bug i connect frenzy to the server using a while true;

Notice: if the program do not close the FD i exhaust the files desc before
reaching the bug.

-- 
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail
/\

Reply via email to