net/SocketError: add syscall specific check functions

Fixes Windows compatibility.
This commit is contained in:
Max Kellermann
2021-01-21 22:04:14 +01:00
parent 2719f62feb
commit 9e2d09dabc
5 changed files with 76 additions and 9 deletions

View File

@@ -278,7 +278,7 @@ HttpdClient::TryWrite() noexcept
metadata_current_position);
if (nbytes < 0) {
auto e = GetSocketError();
if (IsSocketErrorAgain(e))
if (IsSocketErrorSendWouldBlock(e))
return true;
if (!IsSocketErrorClosed(e)) {
@@ -305,7 +305,7 @@ HttpdClient::TryWrite() noexcept
ssize_t nbytes = GetSocket().Write(&empty_data, 1);
if (nbytes < 0) {
auto e = GetSocketError();
if (IsSocketErrorAgain(e))
if (IsSocketErrorSendWouldBlock(e))
return true;
if (!IsSocketErrorClosed(e)) {
@@ -328,7 +328,7 @@ HttpdClient::TryWrite() noexcept
bytes_to_write);
if (nbytes < 0) {
auto e = GetSocketError();
if (IsSocketErrorAgain(e))
if (IsSocketErrorSendWouldBlock(e))
return true;
if (!IsSocketErrorClosed(e)) {