summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Huwald <jh@sotun.de>2012-04-23 16:44:49 (GMT)
committerJan Huwald <jh@sotun.de>2012-04-23 16:44:49 (GMT)
commit7296d84a5cbd61db072544dd375302811b2d29bf (patch)
tree7a80feee1436cdceeec8f1b122ce3a705966ad33
parent4176db98cb9a9437c939ac6b9f85fb176614b2cc (diff)
splash: move locking to splash_sync
-rw-r--r--files/common/etc/splash.sh9
-rwxr-xr-xfiles/common/sbin/splash_sync5
2 files changed, 4 insertions, 10 deletions
diff --git a/files/common/etc/splash.sh b/files/common/etc/splash.sh
index 75eb620..222b2f8 100644
--- a/files/common/etc/splash.sh
+++ b/files/common/etc/splash.sh
@@ -3,15 +3,6 @@ chain_prefix=splash_db_
chain_id_file=/tmp/splash_chain_id
tbl=/tmp/p2ptbl/splash
-lockSplash () {
- exec 666<$chain_id_file
- flock -x 666
-}
-
-unlockSplash () {
- exec 666<&-
-}
-
have_splash_iptable () {
state=${1:-$(fsm get inetable)}
[ "$state" == "queen" ]
diff --git a/files/common/sbin/splash_sync b/files/common/sbin/splash_sync
index bbb4182..aafa49f 100755
--- a/files/common/sbin/splash_sync
+++ b/files/common/sbin/splash_sync
@@ -1,8 +1,11 @@
#!/bin/sh -e
. /etc/splash.sh
+# acquire lock
+exec 666<$chain_id_file
+flock -x 666
+
# check for current inetable state, allowing a command line override
-lockSplash
if have_splash_iptable $1; then
# remove old entries from splash p2ptbl
p2ptbl filter $tbl \
contact: Jan Huwald // Impressum