/* * File : TrackerImpl.java * Created : 08-Dec-2003 * By : parg * * Azureus - a Java Bittorrent client * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details ( see the LICENSE file ). * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.gudy.azureus2.pluginsimpl.local.tracker; /** * @author parg * */ import java.net.InetAddress; import java.net.URL; import java.util.*; import org.gudy.azureus2.plugins.tracker.*; import org.gudy.azureus2.plugins.tracker.web.*; import org.gudy.azureus2.plugins.torrent.*; import org.gudy.azureus2.pluginsimpl.local.torrent.*; import org.gudy.azureus2.core3.tracker.host.*; import org.gudy.azureus2.core3.tracker.util.TRTrackerUtils; import org.gudy.azureus2.core3.util.AEMonitor; import org.gudy.azureus2.core3.util.Debug; public class TrackerImpl extends TrackerWCHelper implements Tracker, TRHostListener2, TRHostAuthenticationListener { private static TrackerImpl singleton; private static AEMonitor class_mon = new AEMonitor( "Tracker" ); private List listeners = new ArrayList(); private TRHost host; private List auth_listeners = new ArrayList(); public static Tracker getSingleton() { try{ class_mon.enter(); if ( singleton == null ){ singleton = new TrackerImpl( TRHostFactory.getSingleton()); } return( singleton ); }finally{ class_mon.exit(); } } protected TrackerImpl( TRHost _host ) { setTracker( this ); host = _host; host.addListener2( this ); } public String getName() { return( host.getName()); } public void setEnableKeepAlive( boolean enable ) { Debug.out( "Keep alive setting ignored for tracker" ); } public URL[] getURLs() { URL[][] url_sets = TRTrackerUtils.getAnnounceURLs(); URL[] res = new URL[url_sets.length]; for (int i=0;i properties ) throws TrackerException { return( new TrackerWebContextImpl( this, name, port, protocol, bind_ip, properties )); } public void torrentAdded( TRHostTorrent t ) { try{ this_mon.enter(); for (int i=0;i