Functions | Variables
post-loop event helpers


static void rescan_mainloop_cb (evutil_socket_t fd, short events, void *arg)


static struct event * rescan_mainloop_ev = NULL

Detailed Description

If we're not careful, Libevent can susceptible to infinite event chains: one event can activate another, whose callback activates another, whose callback activates another, ad infinitum. While this is happening, Libevent won't be checking timeouts, socket-based events, signals, and so on.

We solve this problem by marking some events as "post-loop". A post-loop event behaves like any ordinary event, but any events that it activates cannot run until Libevent has checked for other events at least once.

Function Documentation

◆ rescan_mainloop_cb()

static void rescan_mainloop_cb ( evutil_socket_t  fd,
short  events,
void *  arg 

Callback to implement rescan_mainloop_ev: it simply exits the mainloop, and relies on Tor to re-enter the mainloop since no error has occurred.

Definition at line 109 of file compat_libevent.c.

Variable Documentation

◆ rescan_mainloop_ev

struct event* rescan_mainloop_ev = NULL

An event that stops Libevent from running any more events on the current iteration of its loop, until it has re-checked for socket events, signal events, timeouts, etc.

Definition at line 102 of file compat_libevent.c.

Referenced by mainloop_event_postloop_cb().