Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actually look at return value for read in remote_server #4078

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion source/adios2/toolkit/remote/remote_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,25 @@ static void ReadRequestHandler(CManager cm, CMConnection conn, void *vevent, voi
f->m_CurrentOffset = ReadMsg->Offset;
}
char *tmp = (char *)malloc(ReadMsg->Size);
read(f->m_FileDescriptor, tmp, ReadMsg->Size);
size_t remaining = ReadMsg->Size;
char *pointer = tmp;
while (remaining > 0)
{
ssize_t ret = read(f->m_FileDescriptor, pointer, remaining);
if (ret <= 0)
{
// EOF or error, should send a message back, but we haven't define error handling yet
std::cout << "Read failed! BAD!" << std::endl;
// instead free tmp and return;
free(tmp);
return;
}
else
{
remaining -= ret;
pointer += ret;
}
}
f->m_CurrentOffset += ReadMsg->Size;
_ReadResponseMsg Response;
memset(&Response, 0, sizeof(Response));
Expand Down