- Timestamp:
- Jun 10, 2022, 3:04:27 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- c25338d
- Parents:
- f3da205
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/worker.cfa
rf3da205 r10ba012 26 26 27 27 // Read the http request 28 if( options.log ) sout | "=== Reading request ===";28 if( options.log ) mutex(sout) sout | "=== Reading request ==="; 29 29 [code, closed, file, name_size] = http_read(fd, buffer, len, f); 30 30 f = 0p; … … 41 41 42 42 if(0 == strncmp(file, "plaintext", min(name_size, sizeof("plaintext") ))) { 43 if( options.log ) sout | "=== Request for /plaintext ===";43 if( options.log ) mutex(sout) sout | "=== Request for /plaintext ==="; 44 44 45 45 int ret = answer_plaintext(fd); 46 46 if( ret == -ECONNRESET ) break REQUEST; 47 47 48 if( options.log ) sout | "=== Answer sent ===";48 if( options.log ) mutex(sout) sout | "=== Answer sent ==="; 49 49 continue REQUEST; 50 50 } 51 51 52 52 if(0 == strncmp(file, "ping", min(name_size, sizeof("ping") ))) { 53 if( options.log ) sout | "=== Request for /ping ===";53 if( options.log ) mutex(sout) sout | "=== Request for /ping ==="; 54 54 55 55 // Send the header … … 57 57 if( ret == -ECONNRESET ) break REQUEST; 58 58 59 if( options.log ) sout | "=== Answer sent ===";59 if( options.log ) mutex(sout) sout | "=== Answer sent ==="; 60 60 continue REQUEST; 61 61 } … … 97 97 if( ret == -ECONNRESET ) break REQUEST; 98 98 99 if( options.log ) sout | "=== Answer sent ===";99 if( options.log ) mutex(sout) sout | "=== Answer sent ==="; 100 100 } 101 101 … … 103 103 unsigned long long next = rdtscl(); 104 104 if(next > (last + 500000000)) { 105 if(try_lock(stats_thrd->stats.lock )) {105 if(try_lock(stats_thrd->stats.lock __cfaabi_dbg_ctx2)) { 106 106 push(this.stats.sendfile, stats_thrd->stats.send); 107 107 unlock(stats_thrd->stats.lock); … … 127 127 /* paranoid */ assert( this.conn.pipe[1] != -1 ); 128 128 for() { 129 if( options.log ) sout | "=== Accepting connection ===";129 if( options.log ) mutex(sout) sout | "=== Accepting connection ==="; 130 130 int fd = cfa_accept4( this.sockfd, this.[addr, addrlen, flags], CFA_IO_LAZY ); 131 131 if(fd < 0) { … … 136 136 if(this.done) break; 137 137 138 if( options.log ) sout | "=== New connection" | fd | "" | ", waiting for requests ===";138 if( options.log ) mutex(sout) sout | "=== New connection" | fd | "" | ", waiting for requests ==="; 139 139 size_t len = options.socket.buflen; 140 140 char buffer[len]; 141 141 handle_connection( this.conn, fd, buffer, len, 0p, last ); 142 142 143 if( options.log ) sout | "=== Connection closed ===";143 if( options.log ) mutex(sout) sout | "=== Connection closed ==="; 144 144 } 145 145 } … … 164 164 char buffer[len]; 165 165 PendingRead p; 166 p.next = 0p; 166 167 p.in.buf = (void*)buffer; 167 168 p.in.len = len; 168 169 push(*this.queue, &p); 169 170 170 if( options.log ) sout | "=== Waiting new connection ===";171 if( options.log ) mutex(sout) sout | "=== Waiting new connection ==="; 171 172 handle_connection( this.conn, p.out.fd, buffer, len, &p.f, last ); 172 173 173 if( options.log ) sout | "=== Connection closed ===";174 if( options.log ) mutex(sout) sout | "=== Connection closed ==="; 174 175 if(this.done) break; 175 176 } … … 181 182 182 183 void ?{}( Acceptor & this ) { 183 ((thread&)this){ "Server Worker Thread", *options.clopts.instance, 64000 };184 ((thread&)this){ "Server Acceptor Thread", *options.clopts.instance, 64000 }; 184 185 options.clopts.thrd_cnt++; 185 186 this.done = false;
Note: See TracChangeset
for help on using the changeset viewer.