Ticket #9390: 0001-Bug-9390-Check-for-public-relay-added.patch

File 0001-Bug-9390-Check-for-public-relay-added.patch, 1.7 KB (added by aruna1234, 17 months ago)
  • src/common/compat.c

    From 47b08bab6a548a70f5148e4a91cfaee52bebb391 Mon Sep 17 00:00:00 2001
    From: ArunaMaurya221B <aruna.maurya12@gmail.com>
    Date: Sat, 23 Dec 2017 17:01:39 +0530
    Subject: [PATCH] Bug-9390 Check for public relay added
    
    Bug-9390 Check for public relay added
    
    Bug-9390: Check for public relay added
    ---
     src/common/compat.c | 11 +++++++++--
     1 file changed, 9 insertions(+), 2 deletions(-)
    
    diff --git a/src/common/compat.c b/src/common/compat.c
    index 8194e7f..9ea5816 100644
    a b get_max_sockets(void) 
    16621662/** Number of extra file descriptors to keep in reserve beyond those that we
    16631663 * tell Tor it's allowed to use. */
    16641664#define ULIMIT_BUFFER 32 /* keep 32 extra fd's beyond ConnLimit_ */
     1665#define ULIMIT 8192 /* to check the file descriptor limit */
    16651666
    16661667/** Learn the maximum allowed number of file descriptors, and tell the
    16671668 * system we want to use up to that number. (Some systems have a low soft
    get_max_sockets(void) 
    16831684int
    16841685set_max_file_descriptors(rlim_t limit, int *max_out)
    16851686{
    1686     if(limit < ULIMIT_BUFFER) {
     1687    if (limit < ULIMIT_BUFFER) {
    16871688      log_warn(LD_CONFIG,
    16881689             "ConnLimit must be at least %d. Failing.", ULIMIT_BUFFER);
    16891690      return -1;
    set_max_file_descriptors(rlim_t limit, int *max_out) 
    17791780    limit = INT_MAX;
    17801781  tor_assert(max_out);
    17811782  *max_out = max_sockets = (int)limit - ULIMIT_BUFFER;
    1782    
     1783  /* Check done to warn users who run Tor from tarball */
     1784    if (public_server_mode(get_options())) {
     1785      if(limit < ULIMIT){
     1786        log_warn(LD_CONFIG,
     1787               "Public Relay having too-low file descriptor limit. Raise the file-descriptor limit or run Tor using a package manager");
     1788      }
     1789    }
    17831790  return 0;
    17841791}
    17851792