openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/runtime/nsd_ptcp.c
static rsRetVal CheckConnection(nsd_t* pNsd)
{
    DEFiRet;
    int rc;
    char msgbuf[1]; /* dummy */
    nsd_ptcp_t* pThis = (nsd_ptcp_t*)pNsd;
    ISOBJ_TYPE_assert(pThis, nsd_ptcp);

    rc = recv(pThis->sock, msgbuf, 1, MSG_DONTWAIT | MSG_PEEK);
    if (rc == 0 && errno != EAGAIN)
    {
        dbgprintf("CheckConnection detected broken connection - closing it\n");
        /* in this case, the remote peer had shut down the connection and we
         * need to close our side, too.
         */
        sockClose(&pThis->sock);
        ABORT_FINALIZE(RS_RET_IO_ERROR);
    }
finalize_it:
    RETiRet;
}
/* This function checks if the connection is still alive - well, kind of... It
 * is primarily being used for plain TCP syslog and it is quite a hack. However,
 * as it seems to work, it is worth supporting it. The bottom line is that it
 * should not be called by anything else but a plain tcp syslog sender.
 * In order for it to work, it must be called *immediately* *before* the send()
 * call. For details about what is done, see here:
 * http://blog.gerhards.net/2008/06/getting-bit-more-reliability-from-plain.html
 * rgerhards, 2008-06-09
 */
This function checks if the connection is still alive - well, kind of... It
is primarily being used for plain TCP syslog and it is quite a hack. However,
as it seems to work, it is worth supporting it. The bottom line is that it
should not be called by anything else but a plain tcp syslog sender.
In order for it to work, it must be called *immediately* *before* the send()
call.
This function checks if the connection is still alive - well kind of ... It is primarily being used for plain TCP syslog and it is quite a hack . However as it seems to work it is worth supporting it . The bottom line is that it should not be called by anything else but a plain tcp syslog sender . In order for it to work it must be called * immediately * * before * the send () call .
static rsRetVal CheckConnection(nsd_t* pNsd)
{
    DEFiRet;
    int rc;
    char msgbuf[1]; 
    nsd_ptcp_t* pThis = (nsd_ptcp_t*)pNsd;
    ISOBJ_TYPE_assert(pThis, nsd_ptcp);
    rc = recv(pThis->sock, msgbuf, 1, MSG_DONTWAIT | MSG_PEEK);
    if (rc == 0 && errno != EAGAIN)
    {
        dbgprintf("CheckConnection detected broken connection - closing it\n");
        sockClose(&pThis->sock);
        ABORT_FINALIZE(RS_RET_IO_ERROR);
    }
finalize_it:
    RETiRet;
}
static rsRetVal CheckConnection ( nsd_t * pNsd ) { DEFiRet ; int rc ; char msgbuf [ 1 ] ; nsd_ptcp_t * pThis = ( nsd_ptcp_t * ) pNsd ; ISOBJ_TYPE_assert ( pThis , nsd_ptcp ) ; rc = recv ( pThis -> sock , msgbuf , 1 , MSG_DONTWAIT | MSG_PEEK ) ; if ( rc == 0 && errno != EAGAIN ) { dbgprintf ( " \n " ) ; sockClose ( & pThis -> sock ) ; ABORT_FINALIZE ( RS_RET_IO_ERROR ) ; } finalize_it : RETiRet ; }
This function checks if the connection is still alive - well, kind of...
This function checks if the connection is still alive - well kind of ...
/* dummy */ /* in this case, the remote peer had shut down the connection and we
         * need to close our side, too.
         */