void CreateClientPipes() { string[] inHandles, outHandles; invoker.GetClientPipeHandles(out inHandles, out outHandles); Assert.That(inHandles, Is.Not.Null); Assert.That(outHandles, Is.Not.Null); Assert.That(inHandles.Length, Is.EqualTo(NUM_PIPE_PAIRS)); Assert.That(outHandles.Length, Is.EqualTo(NUM_PIPE_PAIRS)); for (int n = 0; n < NUM_PIPE_PAIRS; ++n) { // Create NON-OWNED safe handles here. Passing in the pipe handle string into the // constructor of AnonymousPipeClientStream would create an owned handle, which // would mess up the ref count and cause double-deletion because both client*Pipes // and the invoker's pipe streams both assume they own the pipe. var outHandle = new SafePipeHandle(new IntPtr(long.Parse(outHandles[n])), false); var inHandle = new SafePipeHandle(new IntPtr(long.Parse(inHandles[n])), false); // Note: The server's in pipes are the client's out pipes and vice versa. clientInPipes[n] = new AnonymousPipeClientStream(PipeDirection.In, outHandle); clientOutPipes[n] = new AnonymousPipeClientStream(PipeDirection.Out, inHandle); } }
private ServerInfo CreateServer( PipeCallInvokerFactory callInvokerFactory, GrpcConnectionFactory connectionFactory) { PipeCallInvoker callInvoker = callInvokerFactory.Create(); GrpcConnection connection = connectionFactory.Create(callInvoker); string[] inPipeHandles, outPipeHandles; callInvoker.GetClientPipeHandles(out inPipeHandles, out outPipeHandles); // Note: The client's out handles are the server's in handles and vice versa. PipeServiceBinder server = new PipeServiceBinder(outPipeHandles, inPipeHandles); var stores = new RemoteObjectStores(); var mockFactories = new LldbMockFactories(); BindServices(server, stores, mockFactories); server.Start(); return(new ServerInfo(server, callInvoker, connection, stores, mockFactories)); }