1
0
mirror of https://github.com/fumiama/simple-dict.git synced 2026-06-05 02:00:25 +08:00

修复sendfile尾指针为定义

This commit is contained in:
fumiama
2021-05-05 22:25:10 +08:00
parent baa98235b2
commit bd76044e9e
2 changed files with 5 additions and 1 deletions

View File

@@ -80,6 +80,8 @@ int main(int argc,char *argv[]) { //usage: ./client host port
headers.iov_len = sizeof(uint32_t);
hdtr.headers = &headers;
hdtr.hdr_cnt = 1;
hdtr.trailers = NULL;
hdtr.trl_cnt = 0;
if(!sendfile(fileno(fp), sockfd, 0, &len, &hdtr, 0)) puts("Send file success.");
else puts("Send file error.");
#else

View File

@@ -147,7 +147,9 @@ int send_all(THREADTIMER *timer) {
headers.iov_len = head_len;
hdtr.headers = &headers;
hdtr.hdr_cnt = 1;
re = sendfile(fileno(fp), timer->accept_fd, 0, &len, &hdtr, 0);
hdtr.trailers = NULL;
hdtr.trl_cnt = 0;
re = !sendfile(fileno(fp), timer->accept_fd, 0, &len, &hdtr, 0);
#else
send_data(timer->accept_fd, timer->data, head_len);
re = !sendfile(timer->accept_fd, fileno(fp), &len, file_size);