]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/initscripts/init.d/tor
tor: Increase number of max. open file descriptors.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / tor
index 4fef577ac7fb2aee0118f0dad1b4643898c65061..878080eff3bbe4c220cbfa2fba85f16494a0f2a9 100644 (file)
@@ -9,13 +9,15 @@
 . /etc/sysconfig/rc
 . ${rc_functions}
 
+FILEDESCRIPTORS="65535"
+
+eval $(/usr/local/bin/readhash /var/ipfire/tor/settings)
+
 function tor_is_enabled() {
        [ "${TOR_ENABLED}" = "on" ] || [ "${TOR_RELAY_ENABLED}" = "on" ]
 }
 
 function setup_firewall() {
-       eval $(/usr/local/bin/readhash /var/ipfire/tor/settings)
-
        # Flush all rules.
        flush_firewall
 
@@ -36,6 +38,11 @@ case "${1}" in
                # Setup firewall.
                setup_firewall
 
+               # Increasing open file descriptors.
+               if [ -n "${FILEDESCRIPTORS}" ]; then
+                       ulimit -n "${FILEDESCRIPTORS}"
+               fi
+
                boot_mesg "Starting tor..."
                loadproc /usr/bin/tor \
                        --runasdaemon 1 \