• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mavlink / MAVSDK / 16634335650

30 Jul 2025 09:38PM UTC coverage: 44.661% (-1.6%) from 46.31%
16634335650

Pull #2626

github

web-flow
Merge 9824a90cb into c0a7c02a0
Pull Request #2626: core: flush after each Log* line

246 of 359 new or added lines in 38 files covered. (68.52%)

438 existing lines in 18 files now uncovered.

15466 of 34630 relevant lines covered (44.66%)

311.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.06
/src/mavsdk/core/http_loader.cpp
1
#include "http_loader.h"
2
#include "curl_wrapper.h"
3

4
namespace mavsdk {
5

6
#ifdef TESTING
7
HttpLoader::HttpLoader(const std::shared_ptr<ICurlWrapper>& curl_wrapper) :
8
    _curl_wrapper(curl_wrapper)
9
{
10
    start();
11
}
12
#endif
13

14
HttpLoader::HttpLoader() : _curl_wrapper(std::make_shared<CurlWrapper>())
86✔
15
{
16
    start();
86✔
17
}
86✔
18

19
HttpLoader::~HttpLoader()
86✔
20
{
21
    stop();
86✔
22
}
86✔
23

24
void HttpLoader::start()
86✔
25
{
26
    _should_exit = false;
86✔
27
    _work_thread = new std::thread(work_thread, this);
86✔
28
}
86✔
29

30
void HttpLoader::stop()
86✔
31
{
32
    _should_exit = true;
86✔
33
    _work_queue.stop();
86✔
34
    if (_work_thread != nullptr) {
86✔
35
        _work_thread->join();
86✔
36
        delete _work_thread;
86✔
37
        _work_thread = nullptr;
86✔
38
    }
39
}
86✔
40

41
bool HttpLoader::download_sync(const std::string& url, const std::string& local_path)
×
42
{
NEW
43
    auto work_item = std::make_shared<DownloadItem>(url, local_path, nullptr);
×
NEW
44
    bool success = do_download(work_item, _curl_wrapper);
×
45
    return success;
×
46
}
×
47

UNCOV
48
void HttpLoader::download_async(
×
49
    const std::string& url, const std::string& local_path, ProgressCallback progress_callback)
50
{
NEW
51
    auto work_item = std::make_shared<DownloadItem>(url, local_path, progress_callback);
×
NEW
52
    _work_queue.enqueue(work_item);
×
UNCOV
53
}
×
54

55
void HttpLoader::work_thread(HttpLoader* self)
86✔
56
{
57
    while (!self->_should_exit) {
172✔
58
        auto item = self->_work_queue.dequeue();
86✔
59
        auto curl_wrapper = self->_curl_wrapper;
86✔
60
        if (!item || curl_wrapper == nullptr) {
86✔
61
            continue;
86✔
62
        }
NEW
63
        do_item(item.value(), curl_wrapper);
×
64
    }
172✔
65
}
86✔
66

NEW
67
void HttpLoader::do_item(
×
68
    const std::shared_ptr<WorkItem>& item, const std::shared_ptr<ICurlWrapper>& curl_wrapper)
69
{
NEW
70
    auto download_item = std::dynamic_pointer_cast<DownloadItem>(item);
×
NEW
71
    if (nullptr != download_item) {
×
NEW
72
        do_download(download_item, curl_wrapper);
×
NEW
73
        return;
×
74
    }
UNCOV
75
}
×
76

NEW
77
bool HttpLoader::do_download(
×
78
    const std::shared_ptr<DownloadItem>& item, const std::shared_ptr<ICurlWrapper>& curl_wrapper)
79
{
NEW
80
    bool success = curl_wrapper->download_file_to_path(
×
NEW
81
        item->get_url(), item->get_local_path(), item->get_progress_callback());
×
82
    return success;
×
83
}
84

85
bool HttpLoader::download_text_sync(const std::string& url, std::string& content)
×
86
{
87
    bool success = _curl_wrapper->download_text(url, content);
×
88
    return success;
×
89
}
90

91
} // namespace mavsdk
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc