mudgangster

Log | Files | Refs

commit 2fbc3eb319b5d2ca9873fac720e4bcc194ef8259
parent 64602479bfe215b4f1fa4cafacd26b9dbca9e3d8
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat,  8 Sep 2018 17:53:47 +0300

Oops

Diffstat:
src/platform_network.cc | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/platform_network.cc b/src/platform_network.cc @@ -93,12 +93,9 @@ bool net_new_tcp( TCPSocket * sock, const NetAddress & addr, const char ** err ) int ok = connect( sock->fd, ( const sockaddr * ) &ss, ss_size ); if( ok == -1 ) { - int ok_close = closesocket( sock->fd ); - if( ok_close == -1 ) - FATAL( "closesocket" ); if( err != NULL ) { #if PLATFORM_WINDOWS - int error = GetLastError(); + int error = WSAGetLastError(); FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), last_error_str, sizeof( last_error_str ), NULL ); @@ -107,6 +104,9 @@ bool net_new_tcp( TCPSocket * sock, const NetAddress & addr, const char ** err ) *err = strerror( errno ); #endif } + int ok_close = closesocket( sock->fd ); + if( ok_close == -1 ) + FATAL( "closesocket" ); // TODO: check for actual coding errors too return false; }