Open
Description
every time test flexkvs, failed at starting
server will close connection right now when recv, maybe the newest test code not pushed to github
when server recv data from connection, the max msg size is 128, but for request body, it need sizeof(*req) + ntohl(req->request.bodylen) at least
static inline int conn_recv(ssctx_t sc, int epfd, struct connection *c)
{
ssize_t res;
/* read until request is complete (or no more data) */
do {
res = ss_read(sc, c->fd, c->rx_buf + c->rx_len, MAX_MSGSIZE -
c->rx_len);
if (res == 0) {
fprintf(stderr, "Closing connection on EOF error: %d count: %d\n", errno, MAX_MSGSIZE - c->rx_len);
conn_close(sc, c);
return -1;
} else if (res < 0 && errno == EAGAIN) {
/* request is not complete yet */
conn_upepoll(sc, epfd, c, 0);
return 1;
} else if (res < 0) {
perror("Closing connection on read error");
conn_close(sc, c);
return -1;
}
c->rx_len += res;
} while (!conn_req_iscomp(c));
return 0;
}
static inline int conn_req_iscomp(struct connection *c)
{
protocol_binary_request_header *req =
(protocol_binary_request_header *) (c->rx_buf + c->rx_off);
uint16_t avail = c->rx_len - c->rx_off;
if (avail < sizeof(*req)) {
return 0;
}
printf("---Function: %s ---line: %d---avail: %d bodylen: %d\n", __FUNCTION__, __LINE__,avail, ntohl(req->request.bodylen));
if (avail < sizeof(*req) + ntohl(req->request.bodylen)) {
return 0;
}
return 1;
}
Metadata
Metadata
Assignees
Labels
No labels