Changeset e95a117 for benchmark


Ignore:
Timestamp:
Jul 20, 2020, 10:23:32 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
289a21c
Parents:
2ecbd7b
Message:

Fixed handling of closed connections.
Started work on cleanly closing server

Location:
benchmark/io/http
Files:
3 edited

Legend:

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

    r2ecbd7b re95a117  
    100100                                {
    101101                                        Acceptor acceptor = { server_fd, (struct sockaddr *)&address, (socklen_t*)&addrlen, 0 };
     102
     103                                        char buffer[128];
     104                                        while(!feof(stdin)) {
     105                                                fgets(buffer, 128, stdin);
     106                                        }
     107
     108                                        printf("Shutting Down\n");
    102109                                }
    103                                 printf("Shutting Down\n");
     110                                printf("Acceptor Closed\n");
    104111
    105112                                // Clean-up the workers
     
    108115                                }
    109116                        }
     117                        printf("Workers Closed\n");
    110118                }
    111119        }
  • benchmark/io/http/protocol.cfa

    r2ecbd7b re95a117  
    7575        for() {
    7676                int ret = cfa_read(fd, it, count);
     77                if(ret == 0 ) return [OK200, true, 0p, 0];
    7778                if(ret < 0 ) {
    78                         if( errno ) return [OK200, true, 0p, 0];
    7979                        if( errno == EAGAIN || errno == EWOULDBLOCK) continue READ;
    8080                        abort( "read error: (%d) %s\n", (int)errno, strerror(errno) );
  • benchmark/io/http/worker.cfa

    r2ecbd7b re95a117  
    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() {
     
    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.