summaryrefslogtreecommitdiff
path: root/src/ot_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ot_tcp.c')
-rw-r--r--src/ot_tcp.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ot_tcp.c b/src/ot_tcp.c
index 5d7b78f..67a0ebc 100644
--- a/src/ot_tcp.c
+++ b/src/ot_tcp.c
@@ -44,9 +44,19 @@ static ssize_t header_complete(char *request, ssize_t byte_count) {
44 44
45void tcp_read(const int64_t sock, struct ot_workstruct *ws) { 45void tcp_read(const int64_t sock, struct ot_workstruct *ws) {
46 struct http_data *cookie = fdstate_cookie(sock); 46 struct http_data *cookie = fdstate_cookie(sock);
47 ssize_t byte_count = read((int)sock, ws->inbuf, G_INBUF_SIZE); 47 ssize_t byte_count;
48 uint32_t generation; 48 uint32_t generation;
49 49
50 /* We're not supposed to read from a socket that waits for
51 our answer. Prevent its reply from being sent to the next
52 generation on that fd. */
53 if (cookie->flag & (STRUCT_HTTP_FLAG_WAITINGFORTASK | STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER)) {
54 http_close(sock);
55 return;
56 }
57
58 byte_count = read((int)sock, ws->inbuf, G_INBUF_SIZE);
59
50 if (byte_count == 0 || (byte_count == -1 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)) { 60 if (byte_count == 0 || (byte_count == -1 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)) {
51 http_close(sock); 61 http_close(sock);
52 return; 62 return;