Changeset d11d6eb for benchmark/io/http/protocol.cfa
- Timestamp:
- Aug 28, 2020, 1:26:28 PM (3 years ago)
- Branches:
- arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8e3034d
- Parents:
- 8e2cb4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/protocol.cfa
r8e2cb4a rd11d6eb 11 11 extern "C" { 12 12 int snprintf ( char * s, size_t n, const char * format, ... ); 13 #include <linux/io_uring.h> 13 14 } 14 15 #include <string.h> 15 16 16 #include <errno.h> 17 17 18 #include "options.hfa" 18 19 19 20 const char * http_msgs[] = { … … 74 75 READ: 75 76 for() { 76 int ret = cfa_read(fd, it, count);77 if(ret == 0 ) return [OK200, true, 0 p, 0];77 int ret = cfa_read(fd, (void*)it, count, 0, -1`s, 0p, 0p); 78 if(ret == 0 ) return [OK200, true, 0, 0]; 78 79 if(ret < 0 ) { 79 80 if( errno == EAGAIN || errno == EWOULDBLOCK) continue READ; … … 88 89 count -= ret; 89 90 90 if( count < 1 ) return [E414, false, 0 p, 0];91 if( count < 1 ) return [E414, false, 0, 0]; 91 92 } 92 93 … … 95 96 it = buffer; 96 97 int ret = memcmp(it, "GET /", 5); 97 if( ret != 0 ) return [E400, false, 0 p, 0];98 if( ret != 0 ) return [E400, false, 0, 0]; 98 99 it += 5; 99 100 … … 106 107 ssize_t ret; 107 108 SPLICE1: while(count > 0) { 108 ret = cfa_splice(ans_fd, &offset, pipe[1], 0p, count, SPLICE_F_MOVE | SPLICE_F_MORE );109 ret = cfa_splice(ans_fd, &offset, pipe[1], 0p, count, SPLICE_F_MOVE | SPLICE_F_MORE, 0, -1`s, 0p, 0p); 109 110 if( ret < 0 ) { 110 111 if( errno != EAGAIN && errno != EWOULDBLOCK) continue SPLICE1; … … 116 117 size_t in_pipe = ret; 117 118 SPLICE2: while(in_pipe > 0) { 118 ret = cfa_splice(pipe[0], 0p, fd, 0p, in_pipe, SPLICE_F_MOVE | SPLICE_F_MORE );119 ret = cfa_splice(pipe[0], 0p, fd, 0p, in_pipe, SPLICE_F_MOVE | SPLICE_F_MORE, 0, -1`s, 0p, 0p); 119 120 if( ret < 0 ) { 120 121 if( errno != EAGAIN && errno != EWOULDBLOCK) continue SPLICE2;
Note: See TracChangeset
for help on using the changeset viewer.