Exemplo n.º 1
0
        public Task HandleEventAsync(GrpcServeNewChainReceivedEvent receivedEventData)
        {
            GrpcCrossChainCommunicationContext grpcCrossChainCommunicationContext =
                (GrpcCrossChainCommunicationContext)receivedEventData.CrossChainCommunicationContextDto;

            grpcCrossChainCommunicationContext.LocalListeningPort = _grpcCrossChainConfigOption.LocalServerPort;
            grpcCrossChainCommunicationContext.ConnectionTimeout  = _grpcCrossChainConfigOption.ConnectionTimeout;
            return(_crossChainGrpcClientController.CreateClient(grpcCrossChainCommunicationContext));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new client to parent chain
        /// </summary>
        /// <returns>
        /// </returns>
        private IGrpcCrossChainClient CreateGrpcClient(GrpcCrossChainCommunicationContext grpcClientBase)
        {
            string uri = grpcClientBase.ToUriStr();

            if (!grpcClientBase.RemoteIsSideChain)
            {
                return(new GrpcClientForParentChain(uri, grpcClientBase.LocalChainId, grpcClientBase.ConnectionTimeout));
            }
            var clientToSideChain = new GrpcClientForSideChain(uri, grpcClientBase.ConnectionTimeout);

            return(clientToSideChain);
        }