Commit ab225aaf authored by Nick Mathewson's avatar Nick Mathewson 🥔
Browse files

Merge branch 'bug10169_025_v2'

Conflicts:
	src/test/test.c
parents bfa0e022 bb375442
Loading
Loading
Loading
Loading

changes/bug10169

0 → 100644
+4 −0
Original line number Diff line number Diff line
  o Major features:
    - Also consider stream buffer sizes when calculating OOM
      conditions. Rename MaxMemInCellQueues to MaxMemInQueues. Fixes
      bug 10169.

changes/bug9686

0 → 100644
+3 −0
Original line number Diff line number Diff line
  o Minor changes:
    - Decrease the lower limit of MaxMemInQueues to 256 MBytes, to
      appease raspberry pi users. Fixes bug 9686.
 No newline at end of file
+5 −5
Original line number Diff line number Diff line
@@ -1727,13 +1727,13 @@ is non-zero):
    localhost, RFC1918 addresses, and so on. This can create security issues;
    you should probably leave it off. (Default: 0)

[[MaxMemInCellQueues]] **MaxMemInCellQueues**  __N__ **bytes**|**KB**|**MB**|**GB**::
[[MaxMemInQueues]] **MaxMemInQueues**  __N__ **bytes**|**KB**|**MB**|**GB**::
    This option configures a threshold above which Tor will assume that it
    needs to stop queueing cells because it's about to run out of memory.
    If it hits this threshold, it will begin killing circuits until it
    has recovered at least 10% of this memory.  Do not set this option too
    needs to stop queueing or buffering data because it's about to run out of
    memory.  If it hits this threshold, it will begin killing circuits until
    it has recovered at least 10% of this memory.  Do not set this option too
    low, or your relay may be unreliable under load.  This option only
    affects circuit queues, so the actual process size will be larger than
    affects some queues, so the actual process size will be larger than
    this. (Default: 8GB)

DIRECTORY SERVER OPTIONS
+43 −1
Original line number Diff line number Diff line
@@ -626,7 +626,9 @@ tor_add_bufferevent_to_rate_limit_group(struct bufferevent *bev,
}
#endif

#if defined(LIBEVENT_VERSION_NUMBER) && LIBEVENT_VERSION_NUMBER >= V(2,1,1)

#if defined(LIBEVENT_VERSION_NUMBER) && LIBEVENT_VERSION_NUMBER >= V(2,1,1) \
  && !defined(TOR_UNIT_TESTS)
void
tor_gettimeofday_cached(struct timeval *tv)
{
@@ -659,5 +661,45 @@ tor_gettimeofday_cache_clear(void)
{
  cached_time_hires.tv_sec = 0;
}

#ifdef TOR_UNIT_TESTS
/** For testing: force-update the cached time to a given value. */
void
tor_gettimeofday_cache_set(const struct timeval *tv)
{
  tor_assert(tv);
  memcpy(&cached_time_hires, tv, sizeof(*tv));
}
#endif
#endif

/**
 * As tor_gettimeofday_cached, but can never move backwards in time.
 *
 * The returned value may diverge from wall-clock time, since wall-clock time
 * can trivially be adjusted backwards, and this can't.  Don't mix wall-clock
 * time with these values in the same calculation.
 *
 * Depending on implementation, this function may or may not "smooth out" huge
 * jumps forward in wall-clock time.  It may or may not keep its results
 * advancing forward (as opposed to stalling) if the wall-clock time goes
 * backwards.  The current implementation does neither of of these.
 *
 * This function is not thread-safe; do not call it outside the main thread.
 *
 * In future versions of Tor, this may return a time does not have its
 * origin at the Unix epoch.
 */
void
tor_gettimeofday_cached_monotonic(struct timeval *tv)
{
  struct timeval last_tv = { 0, 0 };

  tor_gettimeofday_cached(tv);
  if (timercmp(tv, &last_tv, <)) {
    memcpy(tv, &last_tv, sizeof(struct timeval));
  } else {
    memcpy(&last_tv, tv, sizeof(struct timeval));
  }
}
+4 −0
Original line number Diff line number Diff line
@@ -91,6 +91,10 @@ int tor_add_bufferevent_to_rate_limit_group(struct bufferevent *bev,

void tor_gettimeofday_cached(struct timeval *tv);
void tor_gettimeofday_cache_clear(void);
#ifdef TOR_UNIT_TESTS
void tor_gettimeofday_cache_set(const struct timeval *tv);
#endif
void tor_gettimeofday_cached_monotonic(struct timeval *tv);

#endif
Loading