Add MUTEX_TIMEOUT variable

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@150 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2002-07-24 03:47:34 +00:00
parent b698fe4d6f
commit b898747dc3
3 changed files with 22 additions and 3 deletions

View File

@ -3373,6 +3373,7 @@ do_initialize() {
MULTIPORT= MULTIPORT=
DETECT_DNAT_IPADDRS= DETECT_DNAT_IPADDRS=
MERGE_HOSTS= MERGE_HOSTS=
MUTEX_TIMEOUT=
stopping= stopping=
have_mutex= have_mutex=
masq_seq=1 masq_seq=1

View File

@ -92,6 +92,8 @@ determine_zones()
############################################################################### ###############################################################################
get_statedir() get_statedir()
{ {
MUTEX_TIMEOUT=
local config=`find_file shorewall.conf` local config=`find_file shorewall.conf`
if [ -f $config ]; then if [ -f $config ]; then
@ -116,15 +118,19 @@ get_statedir()
mutex_on() mutex_on()
{ {
local try=0 local try=0
local max=30 local max=
local int=2 local int=1
local lockf=$STATEDIR/lock local lockf=$STATEDIR/lock
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
max=${MUTEX_TIMEOUT}
[ -d $STATEDIR ] || mkdir -p $STATEDIR [ -d $STATEDIR ] || mkdir -p $STATEDIR
if qt which lockfile; then if qt which lockfile; then
lockfile -060 -r1 ${lockf} lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
else else
while [ -f ${lockf} -a ${try} -lt ${max} ] ; do while [ -f ${lockf} -a ${try} -lt ${max} ] ; do
sleep ${int} sleep ${int}

View File

@ -291,4 +291,16 @@ DETECT_DNAT_IPADDRS=No
MERGE_HOSTS=Yes MERGE_HOSTS=Yes
#
# Mutex Timeout
#
# The value of this variable determines the number of seconds that programs
# will wait for exclusive access to the Shorewall lock file. After the number
# of seconds corresponding to the value of this variable, programs will assume
# that the last program to hold the lock died without releasing the lock.
#
# If not set or set to the empty value, a value of 60 (60 seconds) is assumed.
MUTEX_TIMEOUT=60
#LAST LINE -- DO NOT REMOVE #LAST LINE -- DO NOT REMOVE