Skip to content

Commit 04a088c

Browse files
committed
[修改]1. 修改热更新模块的字典并发
1 parent df6d29a commit 04a088c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

GameFrameX.Core/Hotfix/HotfixModule.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ internal sealed class HotfixModule
4545
/// <summary>
4646
/// HTTP命令到处理器的映射。
4747
/// </summary>
48-
private readonly Dictionary<string, BaseHttpHandler> _httpHandlerMap = new Dictionary<string, BaseHttpHandler>(512);
48+
private readonly ConcurrentDictionary<string, BaseHttpHandler> _httpHandlerMap = new ConcurrentDictionary<string, BaseHttpHandler>();
4949

5050
/// <summary>
5151
/// RPC请求类型到响应类型的映射。
5252
/// </summary>
53-
private readonly Dictionary<Type, Type> _rpcHandlerMap = new Dictionary<Type, Type>(512);
53+
private readonly ConcurrentDictionary<Type, Type> _rpcHandlerMap = new ConcurrentDictionary<Type, Type>();
5454

5555
/// <summary>
5656
/// 消息ID到处理器类型的映射。
5757
/// </summary>
58-
private readonly Dictionary<int, Type> _tcpHandlerMap = new Dictionary<int, Type>(512);
58+
private readonly ConcurrentDictionary<int, Type> _tcpHandlerMap = new ConcurrentDictionary<int, Type>();
5959

6060
/// <summary>
6161
/// 消息处理类型列表
@@ -271,7 +271,7 @@ private bool AddRpcHandler(Type type)
271271
return false;
272272
}
273273

274-
_rpcHandlerMap.Add(attribute.RequestMessage.GetType(), attribute.ResponseMessage.GetType());
274+
_rpcHandlerMap.TryAdd(attribute.RequestMessage.GetType(), attribute.ResponseMessage.GetType());
275275

276276
return true;
277277
}

0 commit comments

Comments
 (0)