Changeset 30bf197


Ignore:
Timestamp:
08/14/18 10:54:49 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, master, ringdecrementfix, ringperformance
Children:
54a76f2
Parents:
31111c7
Message:

Set SO_REUSEADDR on ndag multicast sockets.

If we don't do this, you can only have one process attached to
an ndag multicast group at any given time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_ndag.c

    rb135888 r30bf197  
    187187        char pstr[16];
    188188        struct group_req greq;
    189         int bufsize;
     189        int bufsize, val;
    190190
    191191        int sock;
     
    226226                fprintf(stderr,
    227227                        "Failed to create multicast socket for %s:%s -- %s\n",
     228                                groupaddr, portstr, strerror(errno));
     229                goto sockcreateover;
     230        }
     231
     232        val = 1;
     233        if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
     234                fprintf(stderr,
     235                        "Failed to set REUSEADDR socket option for %s:%s -- %s\n",
    228236                                groupaddr, portstr, strerror(errno));
    229237                goto sockcreateover;
     
    761769        }
    762770#else
    763         ssock->singlemsg.msg_iov = (struct iovec *) malloc(sizeof(struct iovec));
     771        ssock->singlemsg.msg_iov = (struct iovec *) calloc(1, sizeof(struct iovec));
    764772#endif
    765773
Note: See TracChangeset for help on using the changeset viewer.