From c6cf5c38fb74a2399cc656357be571f1669a36d1 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Fri, 2 Oct 2015 19:24:28 +0200 Subject: [PATCH] Sleep only 1 sec before retry to lock the file The previous 5 seconds might have been appropriate on old, heavy loaded systems, but they will hardly be necessary on modern ones. --- sbr/lock_file.c | 6 +++--- uip/dropsbr.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sbr/lock_file.c b/sbr/lock_file.c index bdce7bb..b62604a 100644 --- a/sbr/lock_file.c +++ b/sbr/lock_file.c @@ -330,7 +330,7 @@ lkopen_kernel(char *file, int access, mode_t mode) j = errno; close(fd); - sleep(5); + sleep(1); } close(fd); @@ -382,7 +382,7 @@ lkopen_dot(char *file, int access, mode_t mode) if (stat(lkinfo.curlock, &st) == -1) { if (i++ > 5) return -1; - sleep(5); + sleep(1); } else { time_t curtime; i = 0; @@ -395,7 +395,7 @@ lkopen_dot(char *file, int access, mode_t mode) if (curtime > st.st_ctime + RSECS) unlink(lkinfo.curlock); else - sleep(5); + sleep(1); } lockname(file, &lkinfo, 1); } diff --git a/uip/dropsbr.c b/uip/dropsbr.c index 0ce5425..45451f8 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -44,7 +44,7 @@ mbox_open(char *file, uid_t uid, gid_t gid, mode_t mode) #endif case ETXTBSY: i = errno; - sleep(5); + sleep(1); continue; default: -- 1.7.10.4