Ignore:
File:
1 edited

Legend:

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

    r03ed863 rc82af9f  
    2626//=============================================================================================
    2727void ?{}( Worker & this ) {
    28         ((thread&)this){ "Server Worker Thread", *options.clopts.instance };
     28        ((thread&)this){ "Server Worker Thread", *options.the_cluster };
    2929        int ret = pipe(this.pipe);
    3030        if( ret < 0 ) { abort( "pipe error: (%d) %s\n", (int)errno, strerror(errno) ); }
     
    3333void main( Worker & this ) {
    3434        CONNECTION:
    35         for() {
    36                 int fd = take(wait_connect);
    37                 if (fd < 0) break;
    38 
    39                 printf("New connection %d, waiting for requests\n", fd);
     35        while( int fd = take(wait_connect); fd >= 0) {
     36            printf("New connection, waiting for requests\n");
    4037                REQUEST:
    4138                for() {
     
    4643
    4744                        // Read the http request
    48                         size_t len = options.socket.buflen;
     45                        size_t len = 1024;
    4946                        char buffer[len];
    5047                        printf("Reading request\n");
     
    5956                        // If this wasn't a request retrun 400
    6057                        if( code != OK200 ) {
    61                                 printf("Invalid Request : %d\n", code_val(code));
     58                                printf("Invalid Request\n");
    6259                                answer_error(fd, code);
    6360                                continue REQUEST;
    6461                        }
    6562
    66                         printf("Request for file %.*s\n", (int)name_size, file);
     63                        printf("Request for file %.*s\n", name_size, file);
    6764
    6865                        // Get the fd from the file cache
     
    9390//=============================================================================================
    9491void ?{}( Acceptor & this, int sockfd, struct sockaddr * addr, socklen_t * addrlen, int flags ) {
    95         ((thread&)this){ "Acceptor Thread", *options.clopts.instance };
     92        ((thread&)this){ "Acceptor Thread", *options.the_cluster };
    9693        this.sockfd  = sockfd;
    9794        this.addr    = addr;
     
    108105                }
    109106
    110                 printf("New connection accepted\n");
     107            printf("New connection accepted\n");
    111108                put( wait_connect, ret );
    112         }
     109      }
    113110}
Note: See TracChangeset for help on using the changeset viewer.