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

mendersoftware / mender-mcu / 1563027719

27 Nov 2024 04:10PM UTC coverage: 9.171% (-0.2%) from 9.334%
1563027719

push

gitlab-ci

vpodzime
chore: Try to detect too many network issues and reset network

Instead of being stuck in the non-working setup.

Ticket: MEN-7555
Changelog: none
Signed-off-by: Vratislav Podzimek <vratislav.podzimek@northern.tech>

0 of 25 new or added lines in 4 files covered. (0.0%)

556 existing lines in 4 files now uncovered.

251 of 2737 relevant lines covered (9.17%)

0.66 hits per line

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

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

20
#include <stdint.h>
21

22
#include "mender-error-counters.h"
23
#include "mender-log.h"
24
#include "mender-utils.h"
25

26
#define NETWORK_ERR_LIMIT 30
27

28
static uint8_t net_errors = 0;
29

30
mender_err_t
NEW
31
mender_err_count_net_inc(void) {
×
NEW
32
    if (net_errors < UINT8_MAX) {
×
NEW
33
        net_errors++;
×
34
    }
NEW
35
    if (net_errors > NETWORK_ERR_LIMIT) {
×
NEW
36
        mender_log_warning("Network errors limit exceeded");
×
NEW
37
        return MENDER_FAIL;
×
38
    }
NEW
39
    return MENDER_OK;
×
40
}
41

42
mender_err_t
NEW
43
mender_err_count_net_check(void) {
×
NEW
44
    if (net_errors > NETWORK_ERR_LIMIT) {
×
NEW
45
        mender_log_warning("Network errors limit exceeded");
×
NEW
46
        return MENDER_FAIL;
×
47
    }
NEW
48
    return MENDER_OK;
×
49
}
50

51
mender_err_t
NEW
52
mender_err_count_net_reset(void) {
×
NEW
53
    net_errors = 0;
×
NEW
54
    return MENDER_OK;
×
55
}
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