SolidSyslog coverage report
Current view: top level - Platform/LwipSocket/Source - SolidSyslogLwipSocketTcpKeepaliveAll.c (source / functions) Coverage Total Hit
Test: SolidSyslog Lines: 100.0 % 9 9
Test Date: 2026-11-12 23:14:35 Functions: 100.0 % 1 1
Branches: 100.0 % 8 8

             Branch data     Line data    Source code
       1                 :             : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
       2                 :             :  * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
       3                 :             :  */
       4                 :             : 
       5                 :             : #include "lwip/opt.h"
       6                 :             : 
       7                 :             : /* The variant for a stack built with LWIP_TCP_KEEPALIVE, where the probe
       8                 :             :    interval and count are settable too, so all three timings are ours. These
       9                 :             :    options take seconds, unlike the TCP_KEEPALIVE the other variant sets. */
      10                 :             : #if LWIP_SOCKET && LWIP_TCP && LWIP_TCP_KEEPALIVE
      11                 :             : 
      12                 :             : #include "lwip/sockets.h"
      13                 :             : 
      14                 :             : #include <stdbool.h>
      15                 :             : 
      16                 :             : #include "SolidSyslogLwipSocketTcpStreamPrivate.h"
      17                 :             : #include "SolidSyslogTunables.h"
      18                 :             : 
      19                 :           4 : bool SolidSyslogLwipSocketTcpStream_ApplyKeepalive(int fd)
      20                 :             : {
      21                 :           4 :     int idleSeconds = (int) SOLIDSYSLOG_TCP_KEEPALIVE_IDLE_SECONDS;
      22                 :           4 :     int intervalSeconds = (int) SOLIDSYSLOG_TCP_KEEPALIVE_INTERVAL_SECONDS;
      23                 :           4 :     int probeCount = (int) SOLIDSYSLOG_TCP_KEEPALIVE_PROBE_COUNT;
      24                 :             : 
      25                 :           4 :     bool accepted = (lwip_setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idleSeconds, sizeof(idleSeconds)) == 0);
      26                 :           4 :     accepted =
      27   [ +  +  +  + ]:           4 :         (lwip_setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &intervalSeconds, sizeof(intervalSeconds)) == 0) && accepted;
      28   [ +  +  +  + ]:           4 :     accepted = (lwip_setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &probeCount, sizeof(probeCount)) == 0) && accepted;
      29                 :           4 :     return accepted;
      30                 :             : }
      31                 :             : 
      32                 :             : #endif /* LWIP_SOCKET && LWIP_TCP && LWIP_TCP_KEEPALIVE */
        

Generated by: LCOV version 2.0-1