예제 #1
0
        private void SendAcceptedReply(RpcCall call, EndPoint remoteAddress, RpcAcceptedReply.AcceptState
                                       acceptState, ChannelHandlerContext ctx)
        {
            RpcAcceptedReply reply = RpcAcceptedReply.GetInstance(call.GetXid(), acceptState,
                                                                  Verifier.VerifierNone);
            XDR @out = new XDR();

            reply.Write(@out);
            if (acceptState == RpcAcceptedReply.AcceptState.ProgMismatch)
            {
                @out.WriteInt(lowProgVersion);
                @out.WriteInt(highProgVersion);
            }
            ChannelBuffer b   = ChannelBuffers.WrappedBuffer(@out.AsReadOnlyWrap().Buffer());
            RpcResponse   rsp = new RpcResponse(b, remoteAddress);

            RpcUtil.SendRpcResponse(ctx, rsp);
        }
예제 #2
0
        public virtual void TestAddRemoveEntries()
        {
            RpcCallCache cache    = new RpcCallCache("test", 100);
            IPAddress    clientIp = Extensions.GetAddressByName("1.1.1.1");
            int          xid      = 100;

            // Ensure null is returned when there is no entry in the cache
            // An entry is added to indicate the request is in progress
            RpcCallCache.CacheEntry e = cache.CheckOrAddToCache(clientIp, xid);
            NUnit.Framework.Assert.IsNull(e);
            e = cache.CheckOrAddToCache(clientIp, xid);
            ValidateInprogressCacheEntry(e);
            // Set call as completed
            RpcResponse response = Org.Mockito.Mockito.Mock <RpcResponse>();

            cache.CallCompleted(clientIp, xid, response);
            e = cache.CheckOrAddToCache(clientIp, xid);
            ValidateCompletedCacheEntry(e, response);
        }
예제 #3
0
 public virtual void SetResponse(RpcResponse response)
 {
     this.response = response;
 }
예제 #4
0
 public CacheEntry()
 {
     // null if no response has been sent
     response = null;
 }
예제 #5
0
 public static void SendRpcResponse(ChannelHandlerContext ctx, RpcResponse response
                                    )
 {
     Channels.FireMessageReceived(ctx, response);
 }
예제 #6
0
            /// <exception cref="System.Exception"/>
            public override void MessageReceived(ChannelHandlerContext ctx, MessageEvent e)
            {
                RpcResponse r = (RpcResponse)e.GetMessage();

                e.GetChannel().Write(r.Data(), r.RemoteAddress());
            }