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); }
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); }
public virtual void SetResponse(RpcResponse response) { this.response = response; }
public CacheEntry() { // null if no response has been sent response = null; }
public static void SendRpcResponse(ChannelHandlerContext ctx, RpcResponse response ) { Channels.FireMessageReceived(ctx, response); }
/// <exception cref="System.Exception"/> public override void MessageReceived(ChannelHandlerContext ctx, MessageEvent e) { RpcResponse r = (RpcResponse)e.GetMessage(); e.GetChannel().Write(r.Data(), r.RemoteAddress()); }