Skip to content

Commit 90b9ed9

Browse files
Merge branch 'develop' into fix/console-tests-failing
2 parents d509fca + c17f5b8 commit 90b9ed9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

com.unity.netcode.adapter.utp/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ All notable changes to this package will be documented in this file. The format
1212

1313
### Fixed
1414

15+
- Fixed issue where the server `NetworkEndPoint` would fail to be created when 'Server Listen Address' is empty. (#1636)
16+
1517
## [1.0.0-pre.5] - 2022-01-26
1618

1719
### Added

com.unity.netcode.adapter.utp/Runtime/UnityTransport.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private enum State
9090
public const int InitialMaxSendQueueSize = 16 * InitialMaxPayloadSize;
9191

9292
private static ConnectionAddressData s_DefaultConnectionAddressData = new ConnectionAddressData()
93-
{ Address = "127.0.0.1", Port = 7777, ServerListenAddress = null };
93+
{ Address = "127.0.0.1", Port = 7777, ServerListenAddress = string.Empty };
9494

9595
#pragma warning disable IDE1006 // Naming Styles
9696
public static INetworkStreamDriverConstructor s_DriverConstructor;
@@ -153,15 +153,16 @@ private static NetworkEndPoint ParseNetworkEndpoint(string ip, ushort port)
153153

154154
public NetworkEndPoint ServerEndPoint => ParseNetworkEndpoint(Address, Port);
155155

156-
public NetworkEndPoint ListenEndPoint => ParseNetworkEndpoint(ServerListenAddress ?? Address, Port);
156+
public NetworkEndPoint ListenEndPoint => ParseNetworkEndpoint(
157+
(ServerListenAddress == string.Empty) ? Address : ServerListenAddress, Port);
157158

158159
[Obsolete("Use ServerEndPoint or ListenEndPoint properties instead.")]
159160
public static implicit operator NetworkEndPoint(ConnectionAddressData d) =>
160161
ParseNetworkEndpoint(d.Address, d.Port);
161162

162163
[Obsolete("Construct manually from NetworkEndPoint.Address and NetworkEndPoint.Port instead.")]
163164
public static implicit operator ConnectionAddressData(NetworkEndPoint d) =>
164-
new ConnectionAddressData() { Address = d.Address.Split(':')[0], Port = d.Port, ServerListenAddress = null };
165+
new ConnectionAddressData() { Address = d.Address.Split(':')[0], Port = d.Port, ServerListenAddress = string.Empty };
165166
}
166167

167168
public ConnectionAddressData ConnectionData = s_DefaultConnectionAddressData;
@@ -442,7 +443,7 @@ public void SetConnectionData(string ipv4Address, ushort port, string listenAddr
442443
{
443444
Address = ipv4Address,
444445
Port = port,
445-
ServerListenAddress = listenAddress
446+
ServerListenAddress = listenAddress ?? string.Empty
446447
};
447448

448449
SetProtocol(ProtocolType.UnityTransport);
@@ -455,7 +456,7 @@ public void SetConnectionData(NetworkEndPoint endPoint, NetworkEndPoint listenEn
455456
{
456457
string serverAddress = endPoint.Address.Split(':')[0];
457458

458-
string listenAddress = null;
459+
string listenAddress = string.Empty;
459460
if (listenEndPoint != default)
460461
{
461462
listenAddress = listenEndPoint.Address.Split(':')[0];

0 commit comments

Comments
 (0)