Changes in benchmark/io/http/worker.cfa [2cd784a:b57db73]
- File:
-
- 1 edited
-
benchmark/io/http/worker.cfa (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/worker.cfa
r2cd784a rb57db73 17 17 //============================================================================================= 18 18 void ?{}( 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 }; 22 20 this.pipe[0] = -1; 23 21 this.pipe[1] = -1; … … 37 35 for() { 38 36 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] ); 40 39 if(fd < 0) { 41 40 if( errno == ECONNABORTED ) break; … … 43 42 abort( "accept error: (%d) %s\n", (int)errno, strerror(errno) ); 44 43 } 45 if(this.done) break;46 44 47 45 if( options.log ) sout | "=== New connection" | fd | "" | ", waiting for requests ==="; … … 57 55 char buffer[len]; 58 56 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); 60 58 61 59 // if we are done, break out of the loop … … 72 70 if( options.log ) sout | "=== Request for /plaintext ==="; 73 71 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)); 75 76 if( ret == -ECONNRESET ) break REQUEST; 76 77
Note:
See TracChangeset
for help on using the changeset viewer.