@@ -90,7 +90,7 @@ private enum State
90
90
public const int InitialMaxSendQueueSize = 16 * InitialMaxPayloadSize ;
91
91
92
92
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 } ;
94
94
95
95
#pragma warning disable IDE1006 // Naming Styles
96
96
public static INetworkStreamDriverConstructor s_DriverConstructor ;
@@ -153,15 +153,16 @@ private static NetworkEndPoint ParseNetworkEndpoint(string ip, ushort port)
153
153
154
154
public NetworkEndPoint ServerEndPoint => ParseNetworkEndpoint ( Address , Port ) ;
155
155
156
- public NetworkEndPoint ListenEndPoint => ParseNetworkEndpoint ( ServerListenAddress ?? Address , Port ) ;
156
+ public NetworkEndPoint ListenEndPoint => ParseNetworkEndpoint (
157
+ ( ServerListenAddress == string . Empty ) ? Address : ServerListenAddress , Port ) ;
157
158
158
159
[ Obsolete ( "Use ServerEndPoint or ListenEndPoint properties instead." ) ]
159
160
public static implicit operator NetworkEndPoint ( ConnectionAddressData d ) =>
160
161
ParseNetworkEndpoint ( d . Address , d . Port ) ;
161
162
162
163
[ Obsolete ( "Construct manually from NetworkEndPoint.Address and NetworkEndPoint.Port instead." ) ]
163
164
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 } ;
165
166
}
166
167
167
168
public ConnectionAddressData ConnectionData = s_DefaultConnectionAddressData ;
@@ -442,7 +443,7 @@ public void SetConnectionData(string ipv4Address, ushort port, string listenAddr
442
443
{
443
444
Address = ipv4Address ,
444
445
Port = port ,
445
- ServerListenAddress = listenAddress
446
+ ServerListenAddress = listenAddress ?? string . Empty
446
447
} ;
447
448
448
449
SetProtocol ( ProtocolType . UnityTransport ) ;
@@ -455,7 +456,7 @@ public void SetConnectionData(NetworkEndPoint endPoint, NetworkEndPoint listenEn
455
456
{
456
457
string serverAddress = endPoint . Address . Split ( ':' ) [ 0 ] ;
457
458
458
- string listenAddress = null ;
459
+ string listenAddress = string . Empty ;
459
460
if ( listenEndPoint != default )
460
461
{
461
462
listenAddress = listenEndPoint . Address . Split ( ':' ) [ 0 ] ;
0 commit comments