Browse Source

Fix premature return in enet_socket_receive

Matt Coburn 5 years ago
parent
commit
df167ddf28
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Source/Native/enet.h

+ 4 - 2
Source/Native/enet.h

@@ -4718,12 +4718,14 @@ int enet_socket_receive(ENetSocket socket, ENetAddress* address, ENetBuffer* buf
 		if (errno == EWOULDBLOCK)
 		if (errno == EWOULDBLOCK)
 			return 0;
 			return 0;
 
 
+		ENET_LOG_ERROR("An error occurred receiving data from socket. recvLength result is negative, returned code is %i.", errno);
 		return -1;
 		return -1;
 	}
 	}
 
 
-	if (msgHdr.msg_flags & MSG_TRUNC)
+	if (msgHdr.msg_flags & MSG_TRUNC) {
 		ENET_LOG_ERROR("Incoming socket message header was truncated.");
 		ENET_LOG_ERROR("Incoming socket message header was truncated.");
-	return -2;
+		return -2;
+	}
 
 
 	if (address != NULL) {
 	if (address != NULL) {
 		address->ipv6 = sin.sin6_addr;
 		address->ipv6 = sin.sin6_addr;