org.klomp.snark

## Class TrackerClient

- java.lang.Object
- - java.lang.Thread
  - - net.i2p.util.I2PThread
    - - net.i2p.util.I2PAppThread
      - - org.klomp.snark.TrackerClient

All Implemented Interfaces:
  Runnable

    public class TrackerClient
    extends I2PAppThread

Informs metainfo tracker of events and gets new peers for peer coordinator.

Author:
  Mark Wielaard (mark@klomp.org)

### Nested Class Summary

### Nested classes/interfaces inherited from class net.i2p.util.I2PThread

`I2PThread.OOMEventListener`

### Nested classes/interfaces inherited from class java.lang.Thread

`Thread.State, Thread.UncaughtExceptionHandler`

### Field Summary

### Fields inherited from class java.lang.Thread

`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

### Constructor Summary

Constructors
Constructor and Description
`TrackerClient(I2PSnarkUtil util, MetaInfo meta, String additionalTrackerURL, PeerCoordinator coordinator, Snark snark)`

### Method Summary

Methods
`void` `halt()` Interrupts this Thread to stop it.
`boolean` `halted()`
`(package private) static boolean` `isValidAnnounce(String ann)`
`void` `run()`
`void` `start()`
`boolean` `started()`
`static String` `urlencode(byte[] bs)` Very lazy byte[] to URL encoder.

### Methods inherited from class net.i2p.util.I2PAppThread

`addOOMEventThreadListener, fireOOM, removeOOMEventThreadListener`

### Methods inherited from class net.i2p.util.I2PThread

`addOOMEventListener, finalize, main, removeOOMEventListener`

### Methods inherited from class java.lang.Thread

`activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### TrackerClient

    public TrackerClient(I2PSnarkUtil util,
                 MetaInfo meta,
                 String additionalTrackerURL,
                 PeerCoordinator coordinator,
                 Snark snark)

Parameters:
  `meta` - null if in magnet mode
  `additionalTrackerURL` - may be null, from the ?tr= param in magnet mode, otherwise ignored

### Method Detail

#### start

    public void start()

Overrides:
  `start` in class `Thread`

#### halted

    public boolean halted()

#### started

    public boolean started()

#### halt

    public void halt()

Interrupts this Thread to stop it.

#### run

    public void run()

Specified by:
  `run` in interface `Runnable`
Overrides:
  `run` in class `I2PThread`

#### urlencode

    public static String urlencode(byte[] bs)

Very lazy byte[] to URL encoder. Just encodes almost everything, even some "normal" chars. By not encoding about 1/4 of the chars, we make random data like hashes about 16% smaller. RFC1738: 0-9a-zA-Z$-_.+!*'(), Us: 0-9a-zA-Z

#### isValidAnnounce

    static boolean isValidAnnounce(String ann)

Returns:
  true for i2p hosts only
Since:
  0.7.12