Beispiel #1
0
 public static DebugNode Create(int idx, Interrupters ints, IDatagramEventSocket bindedDgramSock, IPEndPoint bindTcpEp, IPEndPoint bindUdpEp, int gw_port)
 {
     string db_path = string.Format ("db{0}{1}.sqlite", Path.DirectorySeparatorChar, idx);
     ITcpListener listener = new p2pncs.Net.TcpListener ();
     listener.Bind (bindTcpEp);
     listener.ListenStart ();
     return new DebugNode (idx, ints, listener, bindedDgramSock, bindTcpEp, bindUdpEp, gw_port, db_path);
 }
Beispiel #2
0
 public Program()
 {
     _ints = new Interrupters ();
     _churnInt = new IntervalInterrupter (TimeSpan.FromSeconds (500.0 / NODES), "Churn Timer");
     Directory.CreateDirectory ("db");
 }
Beispiel #3
0
 DebugNode(int idx, Interrupters ints, ITcpListener listener, IDatagramEventSocket bindedDgramSock, IPEndPoint bindTcpEp, IPEndPoint bindUdpEp, int gw_port, string dbpath)
     : base(ints, bindedDgramSock, listener, dbpath, (ushort)bindUdpEp.Port, (ushort)bindTcpEp.Port)
 {
     _idx = idx;
     _bindTcpEP = bindTcpEp;
     _imPrivateKey = ECKeyPair.Create (DefaultAlgorithm.ECDomainName);
     _imPublicKey = Key.Create (_imPrivateKey);
     _name = "Node-" + idx.ToString ("x");
     _app = new WebApp (this, ints);
     _is_gw = gw_port > 0;
     if (_is_gw) {
         _sessionMiddleware = new SessionMiddleware (MMLC.CreateDBConnection, _app);
         _server = HttpServer.CreateEmbedHttpServer (_sessionMiddleware, null, true, true, false, gw_port, 16);
     }
 }