Ignore:
Timestamp:
Aug 16, 2022, 2:45:57 PM (21 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
17c6edeb
Parents:
c4c8571
Message:

Committing http server when I know it works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/socket.cfa

    rc4c8571 r32d1383  
    88        #include <sys/socket.h>
    99        #include <netinet/in.h>
     10        #include <netinet/tcp.h>
    1011}
    1112
     
    3334        }
    3435
     36        int on = 1;
     37        const struct linger l = { 1, 0 };
     38        if (setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0)
     39                abort( "setsockopt SO_LINGER error: (%d) %s\n", (int)errno, strerror(errno) );
     40
     41        if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (const void*)&on, sizeof(on)) < 0)
     42                abort( "setsockopt SO_LINGER error: (%d) %s\n", (int)errno, strerror(errno) );
     43
    3544        if(options.socket.reuseport) {
    36                 int value = 1;
    3745                // if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void*)&on, sizeof(on)))
    3846                //      abort( "setsockopt SO_REUSEADDR error: (%d) %s\n", (int)errno, strerror(errno) );
    39                 if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &value, sizeof(int)) < 0)
     47                if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0)
    4048                        abort( "setsockopt SO_REUSEPORT error: (%d) %s\n", (int)errno, strerror(errno) );
    4149        }
Note: See TracChangeset for help on using the changeset viewer.