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