GCC Code Coverage Report


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