Skip to content

Commit

Permalink
KcpTransport: reuse IPEndPoint.PrettyAddress extension
Browse files Browse the repository at this point in the history
  • Loading branch information
mischa committed May 19, 2024
1 parent 4482c79 commit 1721b56
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions Assets/Mirror/Transports/KCP/KcpTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,7 @@ public override void ServerSend(int connectionId, ArraySegment<byte> segment, in
public override string ServerGetClientAddress(int connectionId)
{
IPEndPoint endPoint = server.GetClientEndPoint(connectionId);
if (endPoint == null) return "";

// Map to IPv4 if "IsIPv4MappedToIPv6" for readability
// "::ffff:127.0.0.1" -> "127.0.0.1"
return
endPoint.Address.IsIPv4MappedToIPv6
? endPoint.Address.MapToIPv4().ToString()
: endPoint.Address.ToString();
return endPoint.PrettyAddress();
}
public override void ServerStop() => server.Stop();
public override void ServerEarlyUpdate()
Expand Down

0 comments on commit 1721b56

Please sign in to comment.