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

mendersoftware / mender / 1583599051

11 Dec 2024 09:04AM UTC coverage: 76.259% (-0.2%) from 76.43%
1583599051

push

gitlab-ci

vpodzime
fix: Cancel the previous request before scheduling a new one in HTTP resumer

The `http::Client()` class is designed to always have only one
HTTP request in progress. Thus, before scheduling a new request
using the same `http::Client` instance, cancel the previous
request to make sure everything is properly reset for the new
one.

Ticket: MEN-7810
Changelog: Fix download resuming to reset the HTTP state and
avoid repeatedly hitting the same error in case of a bad state

Signed-off-by: Vratislav Podzimek <vratislav.podzimek@northern.tech>

1 of 1 new or added line in 1 file covered. (100.0%)

55 existing lines in 11 files now uncovered.

7375 of 9671 relevant lines covered (76.26%)

11182.97 hits per line

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

75.0
/src/mender-auth/context.hpp
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
#ifndef MENDER_AUTH_CONTEXT_HPP
16
#define MENDER_AUTH_CONTEXT_HPP
17

18
#include <client_shared/conf.hpp>
19
#include <common/error.hpp>
20

21
namespace mender {
22
namespace auth {
23
namespace context {
24

25
namespace conf = mender::client_shared::conf;
26
namespace error = mender::common::error;
27

28
using namespace std;
29

30
enum MenderContextErrorCode {
31
        NoError = 0,
32
};
33

34
class MenderContextErrorCategoryClass : public std::error_category {
35
public:
36
        const char *name() const noexcept override;
37
        string message(int code) const override;
38
};
39
extern const MenderContextErrorCategoryClass MenderContextErrorCategory;
40

41
error::Error MakeError(MenderContextErrorCode code, const string &msg);
42

43
class MenderContext {
44
public:
45
        MenderContext(conf::MenderConfig &config) :
4✔
46
                config_ {config} {};
4✔
UNCOV
47
        virtual ~MenderContext() {
×
48
        }
4✔
49

50
        conf::MenderConfig &GetConfig() {
51
                return config_;
52
        }
53

54
private:
55
        conf::MenderConfig &config_;
56
};
57

58
} // namespace context
59
} // namespace auth
60
} // namespace mender
61

62
#endif // MENDER_AUTH_CONTEXT_HPP
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

© 2025 Coveralls, Inc