]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Not enough file descriptors is not fatal, it gets adjusted and warned.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 13 Jul 2010 07:29:01 +0000 (07:29 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 13 Jul 2010 07:29:01 +0000 (07:29 +0000)
git-svn-id: file:///svn/unbound/trunk@2192 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/unbound.c

index d3c0ae12a6672000313e338e7bdc5f04a9f6fd36..c88827bb0399c4390617000ff8580cfc41773d15 100644 (file)
@@ -239,10 +239,16 @@ checkrlimits(struct config_file* cfg)
        }
        if(total > 1024 && 
                strncmp(event_get_version(), "mini-event", 10) == 0) {
-               log_err("too many file descriptors requested. The builtin"
+               log_warn("too many file descriptors requested. The builtin"
                        "mini-event cannot handle more than 1024. Config "
                        "for less fds or compile with libevent");
-               fatal_exit("configuration needs too many file descriptors");
+               if(numthread*perthread_noudp+15 > 1024)
+                       fatal_exit("too much tcp. not enough fds.");
+               cfg->outgoing_num_ports = (int)((1024 
+                       - numthread*perthread_noudp 
+                       - 10 /* safety margin */) /numthread);
+               log_warn("continuing with less udp ports: %u",
+                       cfg->outgoing_num_ports);
        }
        if(perthread > 64 && 
                strncmp(event_get_version(), "winsock-event", 13) == 0) {
@@ -250,7 +256,13 @@ checkrlimits(struct config_file* cfg)
                        " event handler cannot handle more than 64 per "
                        " thread. Config for less fds or compile with "
                        " libevent");
-               fatal_exit("configuration needs too many file descriptors");
+               if(numthread*perthread_noudp+5 > 64)
+                       fatal_exit("too much tcp. not enough fds.");
+               cfg->outgoing_num_ports = (int)((64 
+                       - numthread*perthread_noudp 
+                       - 5 /* safety margin */) /numthread);
+               log_warn("continuing with less udp ports: %u",
+                       cfg->outgoing_num_ports);
        }
 #else  
        (void)cfg;