Example #1
0
 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);
 }
Example #2
0
        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);
        }