@@ -65,7 +65,7 @@ public uint MyClientId
65
65
}
66
66
}
67
67
internal uint myClientId ;
68
- internal Dictionary < uint , NetworkedClient > connectedClients ;
68
+ internal readonly Dictionary < uint , NetworkedClient > connectedClients = new Dictionary < uint , NetworkedClient > ( ) ;
69
69
/// <summary>
70
70
/// Gets a dictionary of connected clients
71
71
/// </summary>
@@ -76,7 +76,7 @@ public Dictionary<uint, NetworkedClient> ConnectedClients
76
76
return connectedClients ;
77
77
}
78
78
}
79
- internal HashSet < uint > pendingClients ;
79
+ internal readonly HashSet < uint > pendingClients = new HashSet < uint > ( ) ;
80
80
internal bool _isServer ;
81
81
internal bool _isClient ;
82
82
/// <summary>
@@ -146,7 +146,7 @@ public bool IsClientConnected
146
146
public NetworkConfig NetworkConfig ;
147
147
148
148
internal EllipticDiffieHellman clientDiffieHellman ;
149
- internal Dictionary < uint , byte [ ] > diffieHellmanPublicKeys ;
149
+ internal readonly Dictionary < uint , byte [ ] > diffieHellmanPublicKeys = new Dictionary < uint , byte [ ] > ( ) ;
150
150
internal byte [ ] clientAesKey ;
151
151
152
152
/// <summary>
@@ -220,26 +220,26 @@ private object Init(bool server)
220
220
lastEventTickTime = 0f ;
221
221
lastReceiveTickTime = 0f ;
222
222
eventOvershootCounter = 0f ;
223
- pendingClients = new HashSet < uint > ( ) ;
224
- connectedClients = new Dictionary < uint , NetworkedClient > ( ) ;
223
+ pendingClients . Clear ( ) ;
224
+ connectedClients . Clear ( ) ;
225
225
messageBuffer = new byte [ NetworkConfig . MessageBufferSize ] ;
226
- diffieHellmanPublicKeys = new Dictionary < uint , byte [ ] > ( ) ;
227
- Data . Cache . messageAttributeHashes = new Dictionary < string , ulong > ( ) ;
228
- Data . Cache . messageAttributeNames = new Dictionary < ulong , string > ( ) ;
229
- MessageManager . channels = new Dictionary < string , int > ( ) ;
230
- MessageManager . messageTypes = new Dictionary < string , ushort > ( ) ;
231
- MessageManager . messageCallbacks = new Dictionary < ushort , Dictionary < int , Action < uint , BitReader > > > ( ) ;
232
- MessageManager . messageHandlerCounter = new Dictionary < ushort , int > ( ) ;
233
- MessageManager . releasedMessageHandlerCounters = new Dictionary < ushort , Stack < int > > ( ) ;
234
- MessageManager . reverseChannels = new Dictionary < int , string > ( ) ;
235
- MessageManager . reverseMessageTypes = new Dictionary < ushort , string > ( ) ;
236
- SpawnManager . spawnedObjects = new Dictionary < uint , NetworkedObject > ( ) ;
237
- SpawnManager . releasedNetworkObjectIds = new Stack < uint > ( ) ;
238
- NetworkPoolManager . Pools = new Dictionary < ushort , NetworkPool > ( ) ;
239
- NetworkPoolManager . PoolNamesToIndexes = new Dictionary < string , ushort > ( ) ;
240
- NetworkSceneManager . registeredSceneNames = new HashSet < string > ( ) ;
241
- NetworkSceneManager . sceneIndexToString = new Dictionary < uint , string > ( ) ;
242
- NetworkSceneManager . sceneNameToIndex = new Dictionary < string , uint > ( ) ;
226
+ diffieHellmanPublicKeys . Clear ( ) ;
227
+ Data . Cache . messageAttributeHashes . Clear ( ) ;
228
+ Data . Cache . messageAttributeNames . Clear ( ) ;
229
+ MessageManager . channels . Clear ( ) ;
230
+ MessageManager . messageTypes . Clear ( ) ;
231
+ MessageManager . messageCallbacks . Clear ( ) ;
232
+ MessageManager . messageHandlerCounter . Clear ( ) ;
233
+ MessageManager . releasedMessageHandlerCounters . Clear ( ) ;
234
+ MessageManager . reverseChannels . Clear ( ) ;
235
+ MessageManager . reverseMessageTypes . Clear ( ) ;
236
+ SpawnManager . spawnedObjects . Clear ( ) ;
237
+ SpawnManager . releasedNetworkObjectIds . Clear ( ) ;
238
+ NetworkPoolManager . Pools . Clear ( ) ;
239
+ NetworkPoolManager . PoolNamesToIndexes . Clear ( ) ;
240
+ NetworkSceneManager . registeredSceneNames . Clear ( ) ;
241
+ NetworkSceneManager . sceneIndexToString . Clear ( ) ;
242
+ NetworkSceneManager . sceneNameToIndex . Clear ( ) ;
243
243
InternalMessageHandler . FinalMessageBuffer = new byte [ NetworkConfig . MessageBufferSize ] ;
244
244
245
245
if ( NetworkConfig . Transport == DefaultTransport . UNET )
0 commit comments