All pastes #120728 Raw Edit

Someone

public text v1 · immutable
·published 2006-08-07 15:01 UTC
rendered paste body
int radiusrun (int **data) {
    // unsigned char buffer[MAX_RADIUS_PACKET_LEN];
    unsigned char *buffer = (unsigned char *) malloc(MAX_RADIUS_PACKET_LEN+1);
    unsigned char *packet;
    packet = buffer;
    struct sockaddr_in * fromaddr;
    int  pfd;
    int  size;
    fd_set set;
    struct timeval timeout;
    int nfd;
    time_t next = 0;
    char saddr[32];

    pfd = create_udp_socket(radiusa_listen_port);

    signal(SIGINT, quit);
    signal(SIGTERM, quit);
    signal(SIGCHLD, SIG_IGN);

    for (;;)  {

        FD_ZERO(&set);
        FD_SET(pfd, &set);

        do  {
            nfd = select(pfd + 1, &set, NULL, NULL, &timeout);
        } while (nfd < 0 && errno == EINTR);

        if (nfd < 0)  {
            error("select 1");
        }