@@ -76,35 +76,6 @@ int mapcache_lock_or_wait_for_resource(mapcache_context *ctx, mapcache_locker *l
7676}
7777
7878
79- void mapcache_locker_disk_clear_all_locks (mapcache_context * ctx , mapcache_locker * self ) {
80- mapcache_locker_disk * ldisk = (mapcache_locker_disk * )self ;
81- apr_dir_t * lockdir ;
82- char errmsg [120 ];
83- apr_finfo_t finfo ;
84- apr_status_t rv = apr_dir_open (& lockdir ,ldisk -> dir ,ctx -> pool );
85- if (rv != APR_SUCCESS ) {
86- ctx -> set_error (ctx ,500 , "failed to open lock directory %s: %s" ,ldisk -> dir ,apr_strerror (rv ,errmsg ,120 ));
87- return ;
88- }
89-
90- while ((apr_dir_read (& finfo , APR_FINFO_DIRENT |APR_FINFO_TYPE |APR_FINFO_NAME , lockdir )) == APR_SUCCESS ) {
91- if (finfo .filetype == APR_REG ) {
92- if (!strncmp (finfo .name , MAPCACHE_LOCKFILE_PREFIX , strlen (MAPCACHE_LOCKFILE_PREFIX ))) {
93- ctx -> log (ctx ,MAPCACHE_WARN ,"found old lockfile %s/%s, deleting it" ,ldisk -> dir ,
94- finfo .name );
95- rv = apr_file_remove (apr_psprintf (ctx -> pool ,"%s/%s" ,ldisk -> dir , finfo .name ),ctx -> pool );
96- if (rv != APR_SUCCESS ) {
97- ctx -> set_error (ctx ,500 , "failed to remove lockfile %s: %s" ,finfo .name ,apr_strerror (rv ,errmsg ,120 ));
98- return ;
99- }
100-
101- }
102-
103- }
104- }
105- apr_dir_close (lockdir );
106- }
107-
10879mapcache_lock_result mapcache_locker_disk_aquire_lock (mapcache_context * ctx , mapcache_locker * self , char * resource , void * * lock ) {
10980 char * lockname , errmsg [120 ];
11081 mapcache_locker_disk * ldisk ;
@@ -180,7 +151,6 @@ mapcache_locker* mapcache_locker_disk_create(mapcache_context *ctx) {
180151 mapcache_locker_disk * ld = (mapcache_locker_disk * )apr_pcalloc (ctx -> pool , sizeof (mapcache_locker_disk ));
181152 mapcache_locker * l = (mapcache_locker * )ld ;
182153 l -> type = MAPCACHE_LOCKER_DISK ;
183- l -> clear_all_locks = mapcache_locker_disk_clear_all_locks ;
184154 l -> aquire_lock = mapcache_locker_disk_aquire_lock ;
185155 l -> parse_xml = mapcache_locker_disk_parse_xml ;
186156 l -> release_lock = mapcache_locker_disk_release_lock ;
@@ -203,17 +173,6 @@ mapcache_lock_result mapcache_locker_fallback_ping_lock(mapcache_context *ctx, m
203173 return flock -> locker -> ping_lock (ctx ,flock -> locker ,resource ,flock -> lock );
204174}
205175
206- void mapcache_locker_fallback_clear_all_locks (mapcache_context * ctx , mapcache_locker * self ) {
207- int i ;
208- mapcache_locker_fallback * locker = (mapcache_locker_fallback * )self ;
209- for (i = 0 ;i < locker -> lockers -> nelts ;i ++ ) {
210- mapcache_locker * child_locker = APR_ARRAY_IDX (locker -> lockers , i , mapcache_locker * );
211- if (child_locker -> clear_all_locks ) {
212- child_locker -> clear_all_locks (ctx ,child_locker );
213- }
214- }
215- }
216-
217176mapcache_lock_result mapcache_locker_fallback_aquire_lock (mapcache_context * ctx , mapcache_locker * self , char * resource , void * * lock ) {
218177 int i ;
219178 mapcache_locker_fallback * locker = (mapcache_locker_fallback * )self ;
@@ -279,19 +238,6 @@ void mapcache_locker_memcache_parse_xml(mapcache_context *ctx, mapcache_locker *
279238 }
280239 lm -> nservers ++ ;
281240 }
282-
283-
284- if ((node = ezxml_child (doc ,"timeout" )) != NULL ) {
285- lm -> timeout = (unsigned int )strtol (node -> txt ,& endptr ,10 );
286- if (* endptr != 0 || lm -> timeout <= 0 ) {
287- ctx -> set_error (ctx , 400 , "failed to parse memcache locker timeout \"%s\". Expecting a positive integer" ,
288- node -> txt );
289- return ;
290- }
291- } else {
292- /* default: timeout after 10 minutes */
293- lm -> timeout = 600 ;
294- }
295241}
296242
297243static char * memcache_key_for_resource (mapcache_context * ctx , mapcache_locker_memcache * lm , const char * resource )
@@ -362,7 +308,7 @@ mapcache_lock_result mapcache_locker_memcache_aquire_lock(mapcache_context *ctx,
362308 return MAPCACHE_LOCK_NOENT ;
363309 }
364310 * lock = memcache ;
365- rv = apr_memcache_add (memcache ,key ,"1" ,1 ,lm -> timeout ,0 );
311+ rv = apr_memcache_add (memcache ,key ,"1" ,1 ,self -> timeout ,0 );
366312 if ( rv == APR_SUCCESS ) {
367313 return MAPCACHE_LOCK_AQUIRED ;
368314 } else if ( rv == APR_EEXIST ) {
@@ -395,7 +341,6 @@ mapcache_locker* mapcache_locker_memcache_create(mapcache_context *ctx) {
395341 mapcache_locker_memcache * lm = (mapcache_locker_memcache * )apr_pcalloc (ctx -> pool , sizeof (mapcache_locker_memcache ));
396342 mapcache_locker * l = (mapcache_locker * )lm ;
397343 l -> type = MAPCACHE_LOCKER_MEMCACHE ;
398- l -> clear_all_locks = NULL ;
399344 l -> aquire_lock = mapcache_locker_memcache_aquire_lock ;
400345 l -> ping_lock = mapcache_locker_memcache_ping_lock ;
401346 l -> parse_xml = mapcache_locker_memcache_parse_xml ;
@@ -411,7 +356,6 @@ mapcache_locker* mapcache_locker_fallback_create(mapcache_context *ctx) {
411356 mapcache_locker_fallback * lm = (mapcache_locker_fallback * )apr_pcalloc (ctx -> pool , sizeof (mapcache_locker_fallback ));
412357 mapcache_locker * l = (mapcache_locker * )lm ;
413358 l -> type = MAPCACHE_LOCKER_FALLBACK ;
414- l -> clear_all_locks = mapcache_locker_fallback_clear_all_locks ;
415359 l -> aquire_lock = mapcache_locker_fallback_aquire_lock ;
416360 l -> ping_lock = mapcache_locker_fallback_ping_lock ;
417361 l -> parse_xml = mapcache_locker_fallback_parse_xml ;
0 commit comments