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

            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 without LWIP_TCP_KEEPALIVE, where the probe
       8              :    interval and count are the stack's own compile-time values and only the idle
       9              :    period is ours. TCP_KEEPALIVE takes milliseconds. */
      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              : enum
      20              : {
      21              :     MILLISECONDS_PER_SECOND = 1000
      22              : };
      23              : 
      24           30 : bool SolidSyslogLwipSocketTcpStream_ApplyKeepalive(int fd)
      25              : {
      26           30 :     int idleMs = (int) SOLIDSYSLOG_TCP_KEEPALIVE_IDLE_SECONDS * MILLISECONDS_PER_SECOND;
      27              : 
      28           30 :     return lwip_setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &idleMs, sizeof(idleMs)) == 0;
      29              : }
      30              : 
      31              : #endif /* LWIP_SOCKET && LWIP_TCP && !LWIP_TCP_KEEPALIVE */
        

Generated by: LCOV version 2.0-1