Exemplo n.º 1
0
 /** Handle the connection by passing it off to an AdminRunner */
 protected void runConnection(Socket socket) throws IOException {
   AdminRunner runner = new AdminRunner(_context, socket);
   I2PThread t = new I2PThread(runner);
   t.setName("Admin Runner");
   // t.setPriority(Thread.MIN_PRIORITY);
   t.setDaemon(true);
   t.start();
 }
Exemplo n.º 2
0
 private void startup(int port) {
   if (_listener == null) {
     _listener = new AdminListener(_context, port);
     I2PThread t = new I2PThread(_listener);
     t.setName("Admin Listener:" + port);
     t.setDaemon(true);
     // t.setPriority(Thread.MIN_PRIORITY);
     t.start();
   } else {
     _listener.setPort(port);
     _listener.restart();
   }
 }
 /**
  * Actually run the connection - listen for I2CP messages and respond. This is the main driver for
  * this class, though it gets all its meat from the {@link net.i2p.data.i2cp.I2CPMessageReader
  * I2CPMessageReader}
  */
 public synchronized void startRunning() throws IOException {
   if (_dead || _reader != null) throw new IllegalStateException();
   _reader =
       new I2CPMessageReader(
           new BufferedInputStream(_socket.getInputStream(), BUF_SIZE),
           new ClientMessageEventListener(_context, this, true));
   _writer = new ClientWriterRunner(_context, this);
   I2PThread t = new I2PThread(_writer);
   t.setName("I2CP Writer " + __id.incrementAndGet());
   t.setDaemon(true);
   t.start();
   _out = new BufferedOutputStream(_socket.getOutputStream());
   _reader.startReading();
   // TODO need a cleaner for unclaimed items in _messages, but we have no timestamps...
 }