Changes in benchmark/io/http/worker.cfa [03ed863:c82af9f]
- File:
-
- 1 edited
-
benchmark/io/http/worker.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/worker.cfa
r03ed863 rc82af9f 26 26 //============================================================================================= 27 27 void ?{}( Worker & this ) { 28 ((thread&)this){ "Server Worker Thread", *options. clopts.instance};28 ((thread&)this){ "Server Worker Thread", *options.the_cluster }; 29 29 int ret = pipe(this.pipe); 30 30 if( ret < 0 ) { abort( "pipe error: (%d) %s\n", (int)errno, strerror(errno) ); } … … 33 33 void main( Worker & this ) { 34 34 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"); 40 37 REQUEST: 41 38 for() { … … 46 43 47 44 // Read the http request 48 size_t len = options.socket.buflen;45 size_t len = 1024; 49 46 char buffer[len]; 50 47 printf("Reading request\n"); … … 59 56 // If this wasn't a request retrun 400 60 57 if( code != OK200 ) { 61 printf("Invalid Request : %d\n", code_val(code));58 printf("Invalid Request\n"); 62 59 answer_error(fd, code); 63 60 continue REQUEST; 64 61 } 65 62 66 printf("Request for file %.*s\n", (int)name_size, file);63 printf("Request for file %.*s\n", name_size, file); 67 64 68 65 // Get the fd from the file cache … … 93 90 //============================================================================================= 94 91 void ?{}( 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 }; 96 93 this.sockfd = sockfd; 97 94 this.addr = addr; … … 108 105 } 109 106 110 printf("New connection accepted\n");107 printf("New connection accepted\n"); 111 108 put( wait_connect, ret ); 112 }109 } 113 110 }
Note:
See TracChangeset
for help on using the changeset viewer.