Ignore:
Timestamp:
Mar 2, 2021, 5:28:32 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6083392
Parents:
182256b (diff), 9eb7a532 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r182256b r266ecf1  
    1717//=============================================================================================
    1818void ?{}( Worker & this ) {
    19         ((thread&)this){ "Server Worker Thread", *options.clopts.instance };
     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]++;
    2022        this.pipe[0] = -1;
    2123        this.pipe[1] = -1;
     
    3537        for() {
    3638                if( options.log ) sout | "=== Accepting connection ===";
    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] );
     39                int fd = cfa_accept4( this.[sockfd, addr, addrlen, flags], CFA_IO_LAZY );
    3940                if(fd < 0) {
    4041                        if( errno == ECONNABORTED ) break;
     
    4243                        abort( "accept error: (%d) %s\n", (int)errno, strerror(errno) );
    4344                }
     45                if(this.done) break;
    4446
    4547                if( options.log ) sout | "=== New connection" | fd | "" | ", waiting for requests ===";
     
    5557                        char buffer[len];
    5658                        if( options.log ) sout | "=== Reading request ===";
    57                         [code, closed, file, name_size] = http_read(fd, buffer, len, &this.cancel);
     59                        [code, closed, file, name_size] = http_read(fd, buffer, len);
    5860
    5961                        // if we are done, break out of the loop
     
    7072                                if( options.log ) sout | "=== Request for /plaintext ===";
    7173
    72                                 char text[] = "Hello, World!\n";
    73 
    74                                 // Send the header
    75                                 int ret = answer_plain(fd, text, sizeof(text));
     74                                int ret = answer_plaintext(fd);
    7675                                if( ret == -ECONNRESET ) break REQUEST;
    7776
Note: See TracChangeset for help on using the changeset viewer.