예제 #1
0
파일: Node.cs 프로젝트: kazuki/p2pncs
 public Node(Interrupters ints, IDatagramEventSocket bindedDgramSock, ITcpListener tcpListener, string db_path, ushort bindUdpPort, ushort bindTcpPort)
 {
     _udpPort = bindUdpPort;
     _tcpPort = bindTcpPort;
     _ints = ints;
     _dgramSock = bindedDgramSock;
     _tcpListener = tcpListener;
     _rtoAlgo = new RFC2988BasedRTOCalculator (TimeSpan.FromSeconds (1), TimeSpan.FromMilliseconds (100), 50, false);
     _messagingSock = new MessagingSocket (_dgramSock, true, SymmetricKey.NoneKey, p2pncs.Serializer.Instance,
         null, ints.MessagingInt, _rtoAlgo, DefaultMessagingRetry, DefaultMessagingRetryBufferSize, DefaultMessagingDuplicationCheckBufferSize);
     _kbrPrivateKey = ECKeyPair.Create (DefaultAlgorithm.ECDomainName);
     _kbr = new SimpleIterativeRouter2 (Key.Create (_kbrPrivateKey), bindTcpPort, _messagingSock, new SimpleRoutingAlgorithm (), p2pncs.Serializer.Instance, true);
     _portChecker = new PortOpenChecker (_kbr);
     _localHT = new OnMemoryLocalHashTable (_kbr, ints.DHTInt);
     IMassKeyDelivererLocalStore mkdLocalStore = _localHT as IMassKeyDelivererLocalStore;
     _dht = new SimpleDHT (_kbr, _messagingSock, _localHT);
     _anonymous = new AnonymousRouter (_dht, _kbrPrivateKey, ints.AnonymousInt);
     ints.KBRStabilizeInt.AddInterruption (Stabilize);
     _mkd = new MassKeyDeliverer (_dht, mkdLocalStore, ints.MassKeyDeliverTimerInt);
     _mmlc = new MMLC (_anonymous, _dht, mkdLocalStore, db_path, ints.StreamSocketTimeoutInt, ints.DFSRePutTimerInt);
     _crawler = new FileInfoCrawler (_tcpListener, _mmlc, _ints.CrawlingTimer);
     _statistics = new Statistics ((AnonymousRouter)_anonymous, _mmlc, _tcpListener);
 }
예제 #2
0
 public InitNodeList(PortOpenChecker checker)
 {
     _checker = checker;
 }