From de35262a3b949ae7bcd94a9472acdfb4b4555a4c Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 21 Apr 2018 02:50:50 +0300 Subject: [PATCH] Fix network send packet --- engine/common/net_ws.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index a7249122..9a2dcacf 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -1397,7 +1397,7 @@ NET_SendPacket */ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to ) { - int ret, err; + int ret; struct sockaddr addr; SOCKET net_socket; @@ -1427,11 +1427,11 @@ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to ret = NET_SendLong( sock, net_socket, data, length, 0, &addr, sizeof( addr )); - if( NET_IsSocketError( err )) + if( NET_IsSocketError( ret )) { { #ifdef _WIN32 - err = pWSAGetLastError(); + int err = pWSAGetLastError(); // WSAEWOULDBLOCK is silent if( err == WSAEWOULDBLOCK ) @@ -1457,7 +1457,7 @@ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to #ifdef _WIN32 else if( err == WSAEADDRNOTAVAIL || err == WSAENOBUFS ) #else - else if( err == EADDRNOTAVAIL || err == ENOBUFS ) + else if( errno == EADDRNOTAVAIL || errno == ENOBUFS ) #endif { MsgDev( D_ERROR, "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to ));