Skip to content

Commit

Permalink
Merge pull request #404 from dngrudin/check_for_sending_errors
Browse files Browse the repository at this point in the history
Changed error detection check when sending data via socket
  • Loading branch information
Enmk authored Dec 16, 2024
2 parents d242cc8 + bfd5a07 commit 2a49a25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clickhouse/base/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,12 @@ size_t SocketOutput::DoWrite(const void* data, size_t len) {
static const int flags = 0;
#endif

if (::send(s_, (const char*)data, (int)len, flags) != (int)len) {
const ssize_t ret = ::send(s_, (const char*)data, (int)len, flags);
if (ret < 0) {
throw std::system_error(getSocketErrorCode(), getErrorCategory(), "fail to send " + std::to_string(len) + " bytes of data");
}

return len;
return (size_t)ret;
}


Expand Down

0 comments on commit 2a49a25

Please sign in to comment.