Merge pull request #33 from lizhen9880/master

修复 issues#32 中提到的问题
This commit is contained in:
ethanDu1 2020-05-21 14:25:28 +08:00 committed by GitHub
commit db9bcadb0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -172,10 +172,20 @@ int32_t HAL_TCP_Read(_IN_ uintptr_t fd, _OU_ unsigned char *buf, _IN_ size_t len
ret = recv(tcp_fd, buf + len_recv, len - len_recv, MSG_DONTWAIT);
if (ret > 0) {
len_recv += ret;
}else if (errno == EINTR || errno == EAGAIN){
}
else if (0 == ret)
{
break;
}
else
{
if (errno == EINTR || errno == EAGAIN)
{
continue;
}
printf("read fail,try again\n");
err_code = ERR_TCP_READ_FAILED;
continue;
break;
}
} while (len_recv < len);