Changeset e68325b


Ignore:
Timestamp:
11/07/17 17:16:31 (3 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
05b65ae
Parents:
de825b5
Message:

Add support for receiving keep-alives on the ndag sockets.

These are used by the ndag transmitter to let clients know that
they haven't died; instead, there have been no packets to export
for some reason.

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/format_ndag.c

    rde825b5 re68325b  
    717717        int i, ret, readybufs, gottime;
    718718        struct timeval tv;
     719        uint8_t rectype;
    719720
    720721        readybufs = 0;
     
    773774
    774775                /* Check that we have a valid nDAG encap record */
    775                 if (check_ndag_header(rt->sources[i].saved[nw], ret) !=
    776                                         NDAG_PKT_ENCAPERF) {
     776                rectype = check_ndag_header(rt->sources[i].saved[nw], ret);
     777
     778                if (rectype == NDAG_PKT_KEEPALIVE) {
     779                        /* Keep-alive, reset startidle and carry on. Don't
     780                         * change nextwrite -- we want to overwrite the
     781                         * keep-alive with usable content. */
     782                        continue;
     783                } else if (rectype != NDAG_PKT_ENCAPERF) {
    777784                        fprintf(stderr, "Received invalid record on the channel for %s:%u.\n",
    778785                                        rt->sources[i].groupaddr,
     
    787794                                (rt->sources[i].nextwriteind + 1) % ENCAP_BUFFERS;
    788795
    789                 /* Save the useful info from the encap header */
     796                /* Get the useful info from the encap header */
    790797                encaphdr = (ndag_encap_t *)(rt->sources[i].saved[nw] +
    791798                                sizeof(ndag_common_t));
     
    798805                rt->sources[i].expectedseq = ntohl(encaphdr->seqno) + 1;
    799806
    800                 /* If all good, skip past the nDAG headers */
    801807                if (rt->sources[i].nextread == NULL) {
     808                        /* If this is our first read, set up 'nextread'
     809                         * by skipping past the nDAG headers */
    802810                        rt->sources[i].nextread = rt->sources[i].saved[0] +
    803811                                        sizeof(ndag_common_t) + sizeof(ndag_encap_t);
  • lib/format_ndag.h

    rea75ec2 re68325b  
    1515        NDAG_PKT_RESTARTED = 0x03,
    1616        NDAG_PKT_ENCAPRT = 0x04,
     17        NDAG_PKT_KEEPALIVE = 0x05
    1718};
    1819
Note: See TracChangeset for help on using the changeset viewer.