diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-05 15:49:15 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-05 15:49:32 +0200 |
commit | 47576447626ac40b61f978836ccb5becbd2b9091 (patch) | |
tree | 8afff1cc0c69b676973a790dfc48bed8face988a /src/config.c | |
parent | 514797c56e431f37de9a00834281f990a7b15c46 (diff) | |
download | wydawca-47576447626ac40b61f978836ccb5becbd2b9091.tar.gz wydawca-47576447626ac40b61f978836ccb5becbd2b9091.tar.bz2 |
Improve locking.
* gconf/gconf-gram.y (string_convert): Rename to gconf_string_convert, make
extern. All uses updated.
* gconf/gconf.h (gconf_string_convert): New proto.
(wydawca_kw): `locking' block statement.
* src/job.c: Introduce a delay before restarting a tempfailed job.
Do not trigger error reporting on tempfail
* src/lock.c: Retry locking attempts, according to configuration.
* src/wydawca.h (lock_retry_attempts, lock_retry_interval): New declarations.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c index 57bd8cb..1cce5fc 100644 --- a/src/config.c +++ b/src/config.c @@ -1301,7 +1301,41 @@ cb_supp_groups (enum gconf_callback_command cmd, } return 0; } - + + +static struct gconf_keyword locking_kw[] = { + { "enable", NULL, N_("Enable or disable locking"), + gconf_type_bool, &enable_locking }, + { "directory", N_("dir"), N_("Set directory for lock files"), + gconf_type_string, &lockdir }, + { "expire-time", N_("interval"), N_("Define lock expiration interval"), + gconf_type_string, &lock_expire_time, 0, cb_interval }, + { "retry-attempts", N_("n"), N_("Number of times to retry locking"), + gconf_type_uint, &lock_retry_attempts }, + { "retry-interval", N_("interval"), N_("Delay between locking attempts"), + gconf_type_string, &lock_retry_interval, 0, cb_interval }, + { NULL } +}; + +static int +cb_locking (enum gconf_callback_command cmd, + gconf_locus_t *locus, + void *varptr, + gconf_value_t *value, + void *cb_data) +{ + if (cmd == gconf_callback_set_value) + { + if (!value || value->type != GCONF_TYPE_STRING) + { + gconf_error (locus, 0, _("expected scalar value as a tag")); + return 1; + } + gconf_string_convert (&enable_locking, gconf_type_bool, value->v.string); + } + return 0; +} + static struct gconf_keyword wydawca_kw[] = { @@ -1321,12 +1355,9 @@ static struct gconf_keyword wydawca_kw[] = { { "group", NULL, N_("Retain these supplementary groups"), gconf_type_string|GCONF_LIST, NULL, 0, cb_supp_groups }, - { "locking", NULL, N_("Enable or disable locking"), - gconf_type_bool, &enable_locking }, - { "lockdir", N_("dir"), N_("Set directory for lock files"), - gconf_type_string, &lockdir }, - { "lock-expire-time", N_("interval"), N_("Define lock expiration interval"), - gconf_type_string, &lock_expire_time, 0, cb_interval }, + { "locking", NULL, N_("Configure locking"), + gconf_type_section, NULL, 0, + cb_locking, NULL, locking_kw }, { "listen", N_("socket"), N_("Listen on this address"), gconf_type_sockaddr, &listen_sockaddr, }, @@ -1416,7 +1447,7 @@ config_init() serv = getservbyname (PACKAGE, "tcp"); if (serv != NULL) gconf_default_port = serv->s_port; - + for (i = 0; i < access_method_count; i++) default_access_method[i] = method_new (i, method_builtin); } |