public NodeServer(NodeInfo nodeInfo, IRoutingTable routingTable, INodeServerClientFactory clientFactory)
 {
     this.nodeInfo      = nodeInfo ?? throw new ArgumentNullException();
     this.routingTable  = routingTable ?? throw new ArgumentNullException();
     this.clientFactory = clientFactory ?? throw new ArgumentNullException();
     this.localClient   = clientFactory.CreateLocalClient();
 }
Beispiel #2
0
        private static DhtProtoServiceClient GetRandomClient()
        {
            var node = GetRandomNode();

            var target  = string.Format("{0}:{1}", node.HostName, node.Port);
            var channel = new Channel(target, ChannelCredentials.Insecure);
            var client  = new DhtProtoServiceClient(channel);

            return(client);
        }
Beispiel #3
0
        public NodeServer(NodeInfo nodeInfo, IRoutingTable routingTable, INodeServerClientFactory clientFactory)
        {
            Throw.IfNull(nodeInfo, nameof(nodeInfo));
            Throw.IfNull(routingTable, nameof(routingTable));
            Throw.IfNull(clientFactory, nameof(clientFactory));

            this.nodeInfo      = nodeInfo;
            this.routingTable  = routingTable;
            this.clientFactory = clientFactory;
            this.localClient   = clientFactory.CreateLocalClient();
        }