コード例 #1
0
ファイル: TcpEndpointTests.cs プロジェクト: pkoronawa/jasper
        public void parsing_uri(string uri, string host, int port, EndpointMode mode)
        {
            var endpoint = new TcpEndpoint();

            endpoint.Parse(uri.ToUri());

            endpoint.HostName.ShouldBe(host);
            endpoint.Port.ShouldBe(port);
            endpoint.Mode.ShouldBe(mode);
        }
コード例 #2
0
        /// <summary>
        /// This method is used to create a matched pair of endpoints used by the Node Provider and
        /// the Node.  The inputs and outputs for each node are automatically configured.
        /// </summary>
        /// <param name="mode">The communications mode for the endpoints.</param>
        /// <param name="host">The component host.</param>
        /// <returns>A matched pair of endpoints.</returns>
        internal static EndpointPair CreateInProcEndpoints(EndpointMode mode, IBuildComponentHost host)
        {
            NodeEndpointInProc node    = new NodeEndpointInProc(mode, host);
            NodeEndpointInProc manager = new NodeEndpointInProc(mode, host);

            // NOTE: This creates a circular reference which must be explicitly broken before these
            // objects can be reclaimed by the garbage collector.
            node._peerEndpoint    = manager;
            manager._peerEndpoint = node;

            return(new EndpointPair(node, manager));
        }
コード例 #3
0
        public JsonRpcEndpoint(Stream transportStream, EndpointMode clientMode)
        {
            TransportStream = transportStream;
            Mode            = clientMode;
            DataWriter      = new StreamWriter(TransportStream);
            DataReader      = new StreamReader(TransportStream);

            _eventLoopCancellationTokenSource = new CancellationTokenSource();
            _eventLoopCancellationToken       = _eventLoopCancellationTokenSource.Token;

            EventLoopTask = Task.Run(ReceiveDataEventLoop, _eventLoopCancellationToken);
        }
コード例 #4
0
        /// <summary>
        /// Instantiates a Node and initializes it to unconnected.
        /// </summary>
        /// <param name="commMode">The communications mode for this endpoint.</param>
        /// <param name="host">The component host.</param>
        private NodeEndpointInProc(EndpointMode commMode, IBuildComponentHost host)
        {
            ErrorUtilities.VerifyThrowArgumentNull(host, "host");

            _status        = LinkStatus.Inactive;
            _mode          = commMode;
            _componentHost = host;

            if (commMode == EndpointMode.Asynchronous)
            {
                _asyncDataMonitor = new object();
            }
        }
コード例 #5
0
        /// <summary>
        /// This method is used to create a matched pair of endpoints used by the Node Provider and
        /// the Node.  The inputs and outputs for each node are automatically configured.
        /// </summary>
        /// <param name="mode">The communications mode for the endpoints.</param>
        /// <param name="host">The component host.</param>
        /// <returns>A matched pair of endpoints.</returns>
        internal static EndpointPair CreateInProcEndpoints(EndpointMode mode, IBuildComponentHost host)
        {
            NodeEndpointInProc node = new NodeEndpointInProc(mode, host);
            NodeEndpointInProc manager = new NodeEndpointInProc(mode, host);

            // NOTE: This creates a circular reference which must be explicitly broken before these
            // objects can be reclaimed by the garbage collector.
            node._peerEndpoint = manager;
            manager._peerEndpoint = node;

            return new EndpointPair(node, manager);
        }
コード例 #6
0
        /// <summary>
        /// Instantiates a Node and initializes it to unconnected.
        /// </summary>
        /// <param name="commMode">The communications mode for this endpoint.</param>
        /// <param name="host">The component host.</param>
        private NodeEndpointInProc(EndpointMode commMode, IBuildComponentHost host)
        {
            ErrorUtilities.VerifyThrowArgumentNull(host, "host");

            _status = LinkStatus.Inactive;
            _mode = commMode;
            _componentHost = host;

            if (commMode == EndpointMode.Asynchronous)
            {
                _asyncDataMonitor = new object();
            }
        }