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