Ignore:
File:
1 edited

Legend:

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

    rc82af9f r03ed863  
    2626//=============================================================================================
    2727void ?{}( Worker & this ) {
    28         ((thread&)this){ "Server Worker Thread", *options.the_cluster };
     28        ((thread&)this){ "Server Worker Thread", *options.clopts.instance };
    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         while( int fd = take(wait_connect); fd >= 0) {
    36             printf("New connection, waiting for requests\n");
     35        for() {
     36                int fd = take(wait_connect);
     37                if (fd < 0) break;
     38
     39                printf("New connection %d, waiting for requests\n", fd);
    3740                REQUEST:
    3841                for() {
     
    4346
    4447                        // Read the http request
    45                         size_t len = 1024;
     48                        size_t len = options.socket.buflen;
    4649                        char buffer[len];
    4750                        printf("Reading request\n");
     
    5659                        // If this wasn't a request retrun 400
    5760                        if( code != OK200 ) {
    58                                 printf("Invalid Request\n");
     61                                printf("Invalid Request : %d\n", code_val(code));
    5962                                answer_error(fd, code);
    6063                                continue REQUEST;
    6164                        }
    6265
    63                         printf("Request for file %.*s\n", name_size, file);
     66                        printf("Request for file %.*s\n", (int)name_size, file);
    6467
    6568                        // Get the fd from the file cache
     
    9093//=============================================================================================
    9194void ?{}( Acceptor & this, int sockfd, struct sockaddr * addr, socklen_t * addrlen, int flags ) {
    92         ((thread&)this){ "Acceptor Thread", *options.the_cluster };
     95        ((thread&)this){ "Acceptor Thread", *options.clopts.instance };
    9396        this.sockfd  = sockfd;
    9497        this.addr    = addr;
     
    105108                }
    106109
    107             printf("New connection accepted\n");
     110                printf("New connection accepted\n");
    108111                put( wait_connect, ret );
    109       }
     112        }
    110113}
Note: See TracChangeset for help on using the changeset viewer.