Directory: | cvmfs/ |
---|---|
File: | cvmfs/network/jobinfo.cc |
Date: | 2025-07-13 02:35:07 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 48 | 57 | 84.2% |
Branches: | 2 | 14 | 14.3% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /** | ||
2 | * This file is part of the CernVM File System. | ||
3 | */ | ||
4 | |||
5 | #include "jobinfo.h" | ||
6 | |||
7 | #include "util/string.h" | ||
8 | |||
9 | namespace download { | ||
10 | |||
11 | atomic_int64 JobInfo::next_uuid = 0; | ||
12 | |||
13 | 2774 | JobInfo::JobInfo(const std::string *u, const bool c, const bool ph, | |
14 |
1/2✓ Branch 2 taken 2774 times.
✗ Branch 3 not taken.
|
2774 | const shash::Any *h, cvmfs::Sink *s) { |
15 |
1/2✓ Branch 1 taken 2774 times.
✗ Branch 2 not taken.
|
2774 | Init(); |
16 | |||
17 | 2774 | url_ = u; | |
18 | 2774 | compressed_ = c; | |
19 | 2774 | probe_hosts_ = ph; | |
20 | 2774 | expected_hash_ = h; | |
21 | 2774 | sink_ = s; | |
22 | 2774 | } | |
23 | |||
24 | ✗ | JobInfo::JobInfo(const std::string *u, const bool ph) { | |
25 | ✗ | Init(); | |
26 | |||
27 | ✗ | url_ = u; | |
28 | ✗ | probe_hosts_ = ph; | |
29 | ✗ | head_request_ = true; | |
30 | } | ||
31 | |||
32 | |||
33 | ✗ | bool JobInfo::IsFileNotFound() { | |
34 | ✗ | if (HasPrefix(*url_, "file://", true /* ignore_case */)) | |
35 | ✗ | return error_code_ == kFailHostConnection; | |
36 | |||
37 | ✗ | return http_code_ == 404; | |
38 | } | ||
39 | |||
40 | 3182 | void JobInfo::Init() { | |
41 | 3182 | id_ = atomic_xadd64(&next_uuid, 1); | |
42 | 3182 | pipe_job_results = NULL; | |
43 | 3182 | url_ = NULL; | |
44 | 3182 | compressed_ = false; | |
45 | 3182 | probe_hosts_ = false; | |
46 | 3182 | head_request_ = false; | |
47 | 3182 | follow_redirects_ = false; | |
48 | 3182 | force_nocache_ = false; | |
49 | 3182 | pid_ = -1; | |
50 | 3182 | uid_ = -1; | |
51 | 3182 | gid_ = -1; | |
52 | 3182 | cred_data_ = NULL; | |
53 | 3182 | interrupt_cue_ = NULL; | |
54 | 3182 | sink_ = NULL; | |
55 | 3182 | expected_hash_ = NULL; | |
56 | 3182 | extra_info_ = NULL; | |
57 | // | ||
58 | 3182 | range_offset_ = -1; | |
59 | 3182 | range_size_ = -1; | |
60 | // | ||
61 | 3182 | curl_handle_ = NULL; | |
62 | 3182 | headers_ = NULL; | |
63 | 3182 | info_header_ = NULL; | |
64 | 3182 | tracing_header_pid_ = NULL; | |
65 | 3182 | tracing_header_gid_ = NULL; | |
66 | 3182 | tracing_header_uid_ = NULL; | |
67 | 3182 | nocache_ = false; | |
68 | 3182 | error_code_ = kFailOther; | |
69 | 3182 | http_code_ = -1; | |
70 | 3182 | link_ = ""; | |
71 | 3182 | num_used_proxies_ = 0; | |
72 | 3182 | num_used_metalinks_ = 0; | |
73 | 3182 | num_used_hosts_ = 0; | |
74 | 3182 | num_retries_ = 0; | |
75 | 3182 | backoff_ms_ = 0; | |
76 | 3182 | current_metalink_chain_index_ = -1; | |
77 | 3182 | current_host_chain_index_ = -1; | |
78 | |||
79 | 3182 | allow_failure_ = false; | |
80 | |||
81 | 3182 | memset(&zstream_, 0, sizeof(zstream_)); | |
82 | 3182 | } | |
83 | |||
84 | } // namespace download | ||
85 |