medfall

A super great game engine
Log | Files | Refs

commit 3a767a340ce3744e501a55b1d2c4de62a4261c9b
parent f56bff1f06655ffdb37fdb4bb9e958d11f105b0d
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat, 23 Dec 2017 19:45:54 +0200

Don't abort on reset connections

Diffstat:
http.cc | 1+
platform_network.cc | 1+
platform_network.h | 1+
3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/http.cc b/http.cc @@ -39,6 +39,7 @@ GetResult http_get( const NetAddress & addr, const char * host, const char * pat size_t bytes_read; TCPRecvResult ok = net_recv( sock, buf, sizeof( buf ), &bytes_read, 10000 ); if( ok == TCP_TIMEOUT ) return GET_ERROR_TIMEOUT; + if( ok == TCP_ERROR ) return GET_ERROR_DISCONNECTED; if( ok == TCP_CLOSED ) break; response.append( buf, bytes_read ); diff --git a/platform_network.cc b/platform_network.cc @@ -229,6 +229,7 @@ TCPRecvResult net_recv( TCPSocket sock, void * buf, size_t buf_size, size_t * by // TODO: this is not right on windows if( r == -1 ) { if( errno == EINTR ) continue; + if( errno == ECONNRESET ) return TCP_ERROR; FATAL( "recv" ); } diff --git a/platform_network.h b/platform_network.h @@ -20,6 +20,7 @@ enum TCPRecvResult { TCP_OK, TCP_TIMEOUT, TCP_CLOSED, + TCP_ERROR, }; struct UDPSocket {