📄 trackertorrentimpl.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: TrackerTorrentImpl.java
package org.gudy.azureus2.pluginsimpl.local.tracker;
import java.util.ArrayList;
import java.util.List;
import org.gudy.azureus2.core3.tracker.host.*;
import org.gudy.azureus2.core3.util.AEMonitor;
import org.gudy.azureus2.plugins.torrent.Torrent;
import org.gudy.azureus2.plugins.tracker.*;
import org.gudy.azureus2.pluginsimpl.local.torrent.TorrentImpl;
// Referenced classes of package org.gudy.azureus2.pluginsimpl.local.tracker:
// TrackerPeerImpl, TrackerTorrentRequestImpl
public class TrackerTorrentImpl
implements TrackerTorrent, TRHostTorrentListener, TRHostTorrentWillBeRemovedListener
{
protected TRHostTorrent host_torrent;
protected List listeners_cow;
protected List removal_listeners;
protected AEMonitor this_mon;
public TrackerTorrentImpl(TRHostTorrent _host_torrent)
{
listeners_cow = new ArrayList();
removal_listeners = new ArrayList();
this_mon = new AEMonitor("TrackerTorrent");
host_torrent = _host_torrent;
}
public TRHostTorrent getHostTorrent()
{
return host_torrent;
}
public void start()
throws TrackerException
{
try
{
host_torrent.start();
}
catch (Throwable e)
{
throw new TrackerException("Start failed", e);
}
}
public void stop()
throws TrackerException
{
try
{
host_torrent.stop();
}
catch (Throwable e)
{
throw new TrackerException("Stop failed", e);
}
}
public void remove()
throws TrackerTorrentRemovalVetoException
{
try
{
host_torrent.remove();
}
catch (TRHostTorrentRemovalVetoException e)
{
throw new TrackerTorrentRemovalVetoException(e.getMessage());
}
}
public boolean canBeRemoved()
throws TrackerTorrentRemovalVetoException
{
try
{
host_torrent.canBeRemoved();
}
catch (TRHostTorrentRemovalVetoException e)
{
throw new TrackerTorrentRemovalVetoException(e.getMessage());
}
return true;
}
public Torrent getTorrent()
{
return new TorrentImpl(host_torrent.getTorrent());
}
public TrackerPeer[] getPeers()
{
org.gudy.azureus2.core3.tracker.host.TRHostPeer peers[] = host_torrent.getPeers();
TrackerPeer res[] = new TrackerPeer[peers.length];
for (int i = 0; i < peers.length; i++)
res[i] = new TrackerPeerImpl(peers[i]);
return res;
}
public int getStatus()
{
int status = host_torrent.getStatus();
switch (status)
{
case 2: // '\002'
return 0;
case 1: // '\001'
return 1;
case 3: // '\003'
return 2;
}
throw new RuntimeException("TrackerTorrent: status invalid");
}
public long getTotalUploaded()
{
return host_torrent.getTotalUploaded();
}
public long getTotalDownloaded()
{
return host_torrent.getTotalDownloaded();
}
public long getAverageUploaded()
{
return host_torrent.getAverageUploaded();
}
public long getAverageDownloaded()
{
return host_torrent.getAverageDownloaded();
}
public long getTotalLeft()
{
return host_torrent.getTotalLeft();
}
public long getCompletedCount()
{
return host_torrent.getCompletedCount();
}
public long getTotalBytesIn()
{
return host_torrent.getTotalBytesIn();
}
public long getAverageBytesIn()
{
return host_torrent.getAverageBytesIn();
}
public long getTotalBytesOut()
{
return host_torrent.getTotalBytesOut();
}
public long getAverageBytesOut()
{
return host_torrent.getAverageBytesOut();
}
public long getAverageScrapeCount()
{
return host_torrent.getAverageScrapeCount();
}
public long getScrapeCount()
{
return host_torrent.getScrapeCount();
}
public long getAverageAnnounceCount()
{
return host_torrent.getAverageAnnounceCount();
}
public long getAnnounceCount()
{
return host_torrent.getAnnounceCount();
}
public int getSeedCount()
{
return host_torrent.getSeedCount();
}
public int getLeecherCount()
{
return host_torrent.getLeecherCount();
}
public int getBadNATCount()
{
return host_torrent.getBadNATCount();
}
public void disableReplyCaching()
{
host_torrent.disableReplyCaching();
}
public boolean isPassive()
{
return host_torrent.isPassive();
}
public long getDateAdded()
{
return host_torrent.getDateAdded();
}
public void preProcess(TRHostTorrentRequest request)
throws TRHostException
{
List listeners_ref = listeners_cow;
for (int i = 0; i < listeners_ref.size(); i++)
try
{
((TrackerTorrentListener)listeners_ref.get(i)).preProcess(new TrackerTorrentRequestImpl(request));
}
catch (TrackerException e)
{
throw new TRHostException(e.getMessage(), e);
}
catch (Throwable e)
{
throw new TRHostException("Pre-process fails", e);
}
}
public void postProcess(TRHostTorrentRequest request)
throws TRHostException
{
List listeners_ref = listeners_cow;
for (int i = 0; i < listeners_ref.size(); i++)
try
{
((TrackerTorrentListener)listeners_ref.get(i)).postProcess(new TrackerTorrentRequestImpl(request));
}
catch (TrackerException e)
{
throw new TRHostException(e.getMessage(), e);
}
catch (Throwable e)
{
throw new TRHostException("Post-process fails", e);
}
}
public void addListener(TrackerTorrentListener listener)
{
this_mon.enter();
List new_listeners = new ArrayList(listeners_cow);
new_listeners.add(listener);
if (new_listeners.size() == 1)
host_torrent.addListener(this);
listeners_cow = new_listeners;
this_mon.exit();
break MISSING_BLOCK_LABEL_72;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeListener(TrackerTorrentListener listener)
{
this_mon.enter();
List new_listeners = new ArrayList(listeners_cow);
new_listeners.remove(listener);
if (new_listeners.size() == 0)
host_torrent.removeListener(this);
listeners_cow = new_listeners;
this_mon.exit();
break MISSING_BLOCK_LABEL_71;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void torrentWillBeRemoved(TRHostTorrent t)
throws TRHostTorrentRemovalVetoException
{
for (int i = 0; i < removal_listeners.size(); i++)
try
{
((TrackerTorrentWillBeRemovedListener)removal_listeners.get(i)).torrentWillBeRemoved(this);
}
catch (TrackerTorrentRemovalVetoException e)
{
throw new TRHostTorrentRemovalVetoException(e.getMessage());
}
}
public void addRemovalListener(TrackerTorrentWillBeRemovedListener listener)
{
this_mon.enter();
removal_listeners.add(listener);
if (removal_listeners.size() == 1)
host_torrent.addRemovalListener(this);
this_mon.exit();
break MISSING_BLOCK_LABEL_61;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeRemovalListener(TrackerTorrentWillBeRemovedListener listener)
{
this_mon.enter();
removal_listeners.remove(listener);
if (removal_listeners.size() == 0)
host_torrent.removeRemovalListener(this);
this_mon.exit();
break MISSING_BLOCK_LABEL_60;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public boolean equals(Object other)
{
if (other instanceof TrackerTorrentImpl)
return host_torrent == ((TrackerTorrentImpl)other).host_torrent;
else
return false;
}
public int hashCode()
{
return host_torrent.hashCode();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -