Skip to content

Commit 9cc2e7a

Browse files
committed
Proposed fix for issue zpl-c#59 in upstream
1 parent e8a7dfa commit 9cc2e7a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

include/enet.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5655,8 +5655,15 @@ extern "C" {
56555655

56565656
if (address != NULL) {
56575657
address->host = sin.sin6_addr;
5658-
address->port = ENET_NET_TO_HOST_16(sin.sin6_port);
56595658
address->sin6_scope_id = sin.sin6_scope_id;
5659+
if (sin.sin6_family == AF_INET || (sin.sin6_family == AF_UNSPEC && sin.sin6_len == sizeof(struct sockaddr_in)))
5660+
{
5661+
enet_inaddr_map4to6(((struct sockaddr_in*)&sin)->sin_addr, &address->host);
5662+
address->sin6_scope_id = 0;
5663+
}
5664+
5665+
address->port = ENET_NET_TO_HOST_16(sin.sin6_port);
5666+
56605667
}
56615668

56625669
return recvLength;

0 commit comments

Comments
 (0)