Ignore:
File:
1 edited

Legend:

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

    r2cd784a rb57db73  
    1717//=============================================================================================
    1818void ?{}( Worker & this ) {
    19         size_t cli = rand() % options.clopts.cltr_cnt;
    20         ((thread&)this){ "Server Worker Thread", *options.clopts.instance[cli] };
    21         options.clopts.thrd_cnt[cli]++;
     19        ((thread&)this){ "Server Worker Thread", *options.clopts.instance };
    2220        this.pipe[0] = -1;
    2321        this.pipe[1] = -1;
     
    3735        for() {
    3836                if( options.log ) sout | "=== Accepting connection ===";
    39                 int fd = cfa_accept4( this.[sockfd, addr, addrlen, flags], CFA_IO_LAZY );
     37                int fd = cfa_accept4( this.[sockfd, addr, addrlen, flags], 0, -1`s, &this.cancel, 0p );
     38                // int fd = accept4( this.[sockfd, addr, addrlen, flags] );
    4039                if(fd < 0) {
    4140                        if( errno == ECONNABORTED ) break;
     
    4342                        abort( "accept error: (%d) %s\n", (int)errno, strerror(errno) );
    4443                }
    45                 if(this.done) break;
    4644
    4745                if( options.log ) sout | "=== New connection" | fd | "" | ", waiting for requests ===";
     
    5755                        char buffer[len];
    5856                        if( options.log ) sout | "=== Reading request ===";
    59                         [code, closed, file, name_size] = http_read(fd, buffer, len);
     57                        [code, closed, file, name_size] = http_read(fd, buffer, len, &this.cancel);
    6058
    6159                        // if we are done, break out of the loop
     
    7270                                if( options.log ) sout | "=== Request for /plaintext ===";
    7371
    74                                 int ret = answer_plaintext(fd);
     72                                char text[] = "Hello, World!\n";
     73
     74                                // Send the header
     75                                int ret = answer_plain(fd, text, sizeof(text));
    7576                                if( ret == -ECONNRESET ) break REQUEST;
    7677
Note: See TracChangeset for help on using the changeset viewer.