Commit ad9b4588 by Ben Clayton

Fix `dap::Socket::read()` when `recv()` errors

Identified by @kuafuwang. Fixes #29
parent 9e313445
......@@ -158,7 +158,9 @@ class dap::Socket::Shared : public dap::ReaderWriter {
if (s == InvalidSocket) {
return 0;
}
return recv(s, reinterpret_cast<char*>(buffer), static_cast<int>(bytes), 0);
auto len =
recv(s, reinterpret_cast<char*>(buffer), static_cast<int>(bytes), 0);
return (len < 0) ? 0 : len;
}
bool write(const void* buffer, size_t bytes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment