Merge branch 'maint-0.3.5'

This commit is contained in:
Nick Mathewson 2018-11-07 16:27:26 -05:00
commit 8e3bae566a

View File

@ -50,6 +50,16 @@ hibernating, phase 2:
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_SYSTEMD
# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
/* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse
* Coverity. Here's a kludge to unconfuse it.
*/
# define __INCLUDE_LEVEL__ 2
# endif /* defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) */
#include <systemd/sd-daemon.h>
#endif /* defined(HAVE_SYSTEMD) */
/** Are we currently awake, asleep, running out of bandwidth, or shutting /** Are we currently awake, asleep, running out of bandwidth, or shutting
* down? */ * down? */
static hibernate_state_t hibernate_state = HIBERNATE_STATE_INITIAL; static hibernate_state_t hibernate_state = HIBERNATE_STATE_INITIAL;
@ -821,6 +831,8 @@ hibernate_soft_limit_reached(void)
return get_accounting_bytes() >= soft_limit; return get_accounting_bytes() >= soft_limit;
} }
#define TOR_USEC_PER_SEC (1000000)
/** Called when we get a SIGINT, or when bandwidth soft limit is /** Called when we get a SIGINT, or when bandwidth soft limit is
* reached. Puts us into "loose hibernation": we don't accept new * reached. Puts us into "loose hibernation": we don't accept new
* connections, but we continue handling old ones. */ * connections, but we continue handling old ones. */