Esempio n. 1
0
 public UdpSocketHandler(
     int listenPort,
     InetAddress bindto,
     Node node,
     long startupTime,
     String title,
     IOStatisticCollector collector)
     throws SocketException {
   this.node = node;
   this.collector = collector;
   this.title = title;
   _bindTo = bindto;
   // Keep the Updater code in, just commented out, for now
   // We may want to be able to do on-line updates.
   //		if (Updater.hasResource()) {
   //			_sock = (DatagramSocket) Updater.getResource();
   //		} else {
   this.listenPort = listenPort;
   _sock = new DatagramSocket(listenPort, bindto);
   int sz = _sock.getReceiveBufferSize();
   if (sz < 65536) {
     _sock.setReceiveBufferSize(65536);
   }
   try {
     // Exit reasonably quickly
     _sock.setReuseAddress(true);
   } catch (SocketException e) {
     throw new RuntimeException(e);
   }
   //		}
   // Only used for debugging, no need to seed from Yarrow
   dropRandom = node.fastWeakRandom;
   logMINOR = Logger.shouldLog(LogLevel.MINOR, this);
   logDEBUG = Logger.shouldLog(LogLevel.DEBUG, this);
   tracker = AddressTracker.create(node.lastBootID, node.runDir(), listenPort);
   tracker.startSend(startupTime);
 }