private void AddCallContextAwaiter(IChannelId channelId, int rpcId, ICallContext callContext) { if (!CallContexts.TryGetValue(channelId, out ConcurrentDictionary <int, ICallContext> callContexts)) { callContexts = new ConcurrentDictionary <int, ICallContext>(); CallContexts.AddOrUpdate(channelId, callContexts, (k, v) => callContexts); } callContexts.AddOrUpdate(rpcId, callContext, (k, v) => callContext); }
private ICallContext RemoveCallAwaiter(IChannelHandlerContext context, int rpcId) { if (!CallContexts.TryGetValue(context.Channel.Id, out ConcurrentDictionary <int, ICallContext> callContexts)) { return(null); } callContexts.TryRemove(rpcId, out ICallContext callContext); return(callContext); }