summaryrefslogtreecommitdiff
path: root/src/network/core/tcp_http.cpp
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-04-30 15:38:22 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-01 19:36:22 +0200
commit22720332eb9922e20148c7aae1127f7304f6f7d3 (patch)
tree0efbcfac24474a10f88f956c1f4721cdd7af97e0 /src/network/core/tcp_http.cpp
parent0eb17a70af86d11e49d9560088900c9d65cb07c1 (diff)
downloadopenttd-22720332eb9922e20148c7aae1127f7304f6f7d3.tar.xz
Codechange: encapsulate network error handling
Diffstat (limited to 'src/network/core/tcp_http.cpp')
-rw-r--r--src/network/core/tcp_http.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/core/tcp_http.cpp b/src/network/core/tcp_http.cpp
index e0c269faf..4f29df191 100644
--- a/src/network/core/tcp_http.cpp
+++ b/src/network/core/tcp_http.cpp
@@ -225,10 +225,10 @@ int NetworkHTTPSocketHandler::Receive()
for (;;) {
ssize_t res = recv(this->sock, (char *)this->recv_buffer + this->recv_pos, lengthof(this->recv_buffer) - this->recv_pos, 0);
if (res == -1) {
- int err = NetworkGetLastError();
- if (err != EWOULDBLOCK) {
- /* Something went wrong... (ECONNRESET is connection reset by peer) */
- if (err != ECONNRESET) DEBUG(net, 0, "recv failed with error %s", NetworkGetErrorString(err));
+ NetworkError err = NetworkError::GetLast();
+ if (!err.WouldBlock()) {
+ /* Something went wrong... */
+ if (!err.IsConnectionReset()) DEBUG(net, 0, "recv failed with error %s", err.AsString());
return -1;
}
/* Connection would block, so stop for now */