| 449 | } |
| 450 | |
| 451 | static int refresh_lock(struct remote_lock *lock) |
| 452 | { |
| 453 | struct active_request_slot *slot; |
| 454 | struct slot_results results; |
| 455 | struct curl_slist *dav_headers; |
| 456 | int rc = 0; |
| 457 | |
| 458 | lock->refreshing = 1; |
| 459 | |
| 460 | dav_headers = get_dav_token_headers(lock, DAV_HEADER_IF | DAV_HEADER_TIMEOUT); |
| 461 | |
| 462 | slot = get_active_slot(); |
| 463 | slot->results = &results; |
| 464 | curl_setup_http_get(slot->curl, lock->url, DAV_LOCK); |
| 465 | curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers); |
| 466 | |
| 467 | if (start_active_slot(slot)) { |
| 468 | run_active_slot(slot); |
| 469 | if (results.curl_result != CURLE_OK) { |
| 470 | fprintf(stderr, "LOCK HTTP error %ld\n", |
| 471 | results.http_code); |
| 472 | } else { |
| 473 | lock->start_time = time(NULL); |
| 474 | rc = 1; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | lock->refreshing = 0; |
| 479 | curl_slist_free_all(dav_headers); |
| 480 | |
| 481 | return rc; |
| 482 | } |
| 483 | |
| 484 | static void check_locks(void) |
| 485 | { |
no test coverage detected