File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments