public class Config extends Object
Constructor and Description |
---|
Config()
Create a config with default parameters.
|
Config(Config config)
Clone the provided config.
|
Modifier and Type | Method and Description |
---|---|
InetAddress |
getAcceptorAddress() |
int |
getAcceptorPort() |
EncryptionPolicy |
getEncryptionPolicy() |
int |
getHashingBufferSize()
Get the digest buffer size
|
int |
getMaxConcurrentlyActivePeerConnectionsPerTorrent() |
int |
getMaxIOQueueSize() |
Duration |
getMaxMessageProcessingInterval() |
int |
getMaxOutstandingRequests() |
int |
getMaxPeerConnections() |
int |
getMaxPeerConnectionsPerTorrent() |
int |
getMaxPendingConnectionRequests() |
Duration |
getMaxPieceReceivingTime() |
int |
getMaxSimultaneouslyAssignedPieces() |
int |
getMaxTransferBlockSize() |
int |
getMetadataExchangeBlockSize() |
int |
getMetadataExchangeMaxSize() |
int |
getMsePrivateKeySize() |
Duration |
getMseWaitBetweenReads() |
int |
getNetworkBufferSize() |
int |
getNumberOfPeersToRequestFromTracker() |
int |
getNumOfHashingThreads() |
Optional<InetAddress> |
getPeerAddress() |
Duration |
getPeerConnectionInactivityThreshold() |
int |
getPeerConnectionRetryCount() |
Duration |
getPeerConnectionRetryInterval() |
Duration |
getPeerConnectionTimeout() |
Duration |
getPeerDiscoveryInterval() |
Duration |
getPeerHandshakeTimeout() |
Duration |
getShutdownHookTimeout() |
Duration |
getTimeoutedAssignmentPeerBanDuration() |
Duration |
getTrackerQueryInterval() |
Duration |
getTrackerTimeout()
Tracker/peer source timeout
See
setTrackerTimeout(Duration) for the explanation on how this is used |
int |
getTransferBlockSize() |
Duration |
getUnreachablePeerBanDuration() |
boolean |
isMseDisabled() |
void |
setAcceptorAddress(InetAddress acceptorAddress) |
void |
setAcceptorPort(int acceptorPort) |
void |
setEncryptionPolicy(EncryptionPolicy encryptionPolicy) |
void |
setHashingBufferSize(int hashingBufferSize)
Set the size of the io buffer used for reading from files to verify their digest.
|
void |
setMaxConcurrentlyActivePeerConnectionsPerTorrent(int maxConcurrentlyActivePeerConnectionsPerTorrent)
Maximum number of peer connections that are allowed to request and receive pieces.
|
void |
setMaxIOQueueSize(int maxIOQueueSize) |
void |
setMaxMessageProcessingInterval(Duration maxMessageProcessingInterval)
This option is related to the adaptive message processing interval feature in the message dispatcher.
|
void |
setMaxOutstandingRequests(int maxOutstandingRequests) |
void |
setMaxPeerConnections(int maxPeerConnections) |
void |
setMaxPeerConnectionsPerTorrent(int maxPeerConnectionsPerTorrent) |
void |
setMaxPendingConnectionRequests(int maxPendingConnectionRequests) |
void |
setMaxPieceReceivingTime(Duration maxPieceReceivingTime) |
void |
setMaxSimultaneouslyAssignedPieces(int maxSimultaneouslyAssignedPieces)
Set the number of pieces that are assigned to a single peer
|
void |
setMaxTransferBlockSize(int maxTransferBlockSize) |
void |
setMetadataExchangeBlockSize(int metadataExchangeBlockSize) |
void |
setMetadataExchangeMaxSize(int metadataExchangeMaxSize) |
void |
setMseDisabled(boolean mseDisabled) |
void |
setMsePrivateKeySize(int msePrivateKeySize) |
void |
setMseWaitBetweenReads(Duration mseWaitBetweenReads) |
void |
setNetworkBufferSize(int networkBufferSize) |
void |
setNumberOfPeersToRequestFromTracker(int numberOfPeersToRequestFromTracker) |
void |
setNumOfHashingThreads(int numOfHashingThreads) |
void |
setPeerAddress(InetAddress peerAddress)
Set the address to send to the tracker.
|
void |
setPeerConnectionInactivityThreshold(Duration peerConnectionInactivityThreshold) |
void |
setPeerConnectionRetryCount(int peerConnectionRetryCount) |
void |
setPeerConnectionRetryInterval(Duration peerConnectionRetryInterval) |
void |
setPeerConnectionTimeout(Duration peerConnectionTimeout) |
void |
setPeerDiscoveryInterval(Duration peerDiscoveryInterval) |
void |
setPeerHandshakeTimeout(Duration peerHandshakeTimeout) |
void |
setShutdownHookTimeout(Duration shutdownHookTimeout) |
void |
setTimeoutedAssignmentPeerBanDuration(Duration timeoutedAssignmentPeerBanDuration) |
void |
setTrackerQueryInterval(Duration trackerQueryInterval) |
void |
setTrackerTimeout(Duration trackerTimeout)
Set the tracker/peer source timeout
Currently used in the following contexts:
- HTTP trackers: used as connection timeout and SO_TIMEOUT;
default is 30 seconds
- UDP trackers: used as an additional limit on maximal BEP-0015 timeout;
formula is Math.min(3840 seconds, trackerTimeout)
- all ScheduledPeerSources (HTTP, UDP, DHT): used during the first (initial)
peer collection as a limit on the time to wait for the collection to finish
before querying the next peer source; default is 10 seconds
|
void |
setTransferBlockSize(int transferBlockSize) |
void |
setUnreachablePeerBanDuration(Duration unreachablePeerBanDuration) |
public Config()
public Config(Config config)
config
- Config to take parameters from.public void setAcceptorAddress(InetAddress acceptorAddress)
acceptorAddress
- Local link that will be used by the incoming connection acceptor.public InetAddress getAcceptorAddress()
public Optional<InetAddress> getPeerAddress()
public void setPeerAddress(InetAddress peerAddress)
getAcceptorAddress()
peerAddress
- the address to send to the tracker.public void setAcceptorPort(int acceptorPort)
acceptorPort
- Local port that will be used by the incoming connection acceptor.public int getAcceptorPort()
public void setPeerDiscoveryInterval(Duration peerDiscoveryInterval)
peerDiscoveryInterval
- Interval at which peer sources should be queried for new peers.public Duration getPeerDiscoveryInterval()
public void setPeerHandshakeTimeout(Duration peerHandshakeTimeout)
peerHandshakeTimeout
- Time to wait for a peer's handshake.public Duration getPeerHandshakeTimeout()
public void setPeerConnectionRetryInterval(Duration peerConnectionRetryInterval)
peerConnectionRetryInterval
- Interval at which attempts to connect to a peer will be performedpublic Duration getPeerConnectionRetryInterval()
public void setPeerConnectionRetryCount(int peerConnectionRetryCount)
peerConnectionRetryCount
- Max number of attempts to connect to a peerpublic int getPeerConnectionRetryCount()
public void setPeerConnectionTimeout(Duration peerConnectionTimeout)
peerConnectionTimeout
- Amount of time to wait for establishing of a peer connectionpublic Duration getPeerConnectionTimeout()
public void setPeerConnectionInactivityThreshold(Duration peerConnectionInactivityThreshold)
peerConnectionInactivityThreshold
- Amount of time after which an inactive peer connection will be droppedpublic Duration getPeerConnectionInactivityThreshold()
public void setTrackerQueryInterval(Duration trackerQueryInterval)
trackerQueryInterval
- Interval at which trackers will be queried for peers.public Duration getTrackerQueryInterval()
public void setTrackerTimeout(Duration trackerTimeout)
trackerTimeout
- the amount of time to wait for a response from the trackerpublic Duration getTrackerTimeout()
setTrackerTimeout(Duration)
for the explanation on how this is usedpublic void setMaxPeerConnections(int maxPeerConnections)
maxPeerConnections
- Maximum amount of established peer connections per runtime
(all torrent processing sessions combined).public int getMaxPeerConnections()
public void setMaxPeerConnectionsPerTorrent(int maxPeerConnectionsPerTorrent)
maxPeerConnectionsPerTorrent
- Maximum number of established peer connections
within a torrent processing session.public int getMaxPeerConnectionsPerTorrent()
public void setTransferBlockSize(int transferBlockSize)
transferBlockSize
- Network transfer block sizepublic int getTransferBlockSize()
public void setMaxTransferBlockSize(int maxTransferBlockSize)
maxTransferBlockSize
- Maximum supported transfer block size.public int getMaxTransferBlockSize()
public void setMaxIOQueueSize(int maxIOQueueSize)
maxIOQueueSize
- Maximum depth of I/O operations queue (read/write blocks).public int getMaxIOQueueSize()
public void setShutdownHookTimeout(Duration shutdownHookTimeout)
shutdownHookTimeout
- Amount of time to wait for a shutdown hook to execute before killing itpublic Duration getShutdownHookTimeout()
public void setNumOfHashingThreads(int numOfHashingThreads)
numOfHashingThreads
- Set this value to 2 or greater,
if verification of the torrent data should be parallelizedpublic int getNumOfHashingThreads()
public void setMaxConcurrentlyActivePeerConnectionsPerTorrent(int maxConcurrentlyActivePeerConnectionsPerTorrent)
Note that this value implicitly affects when the torrent processing session enters the so-called "endgame" mode. By default it's assumed that the endgame mode should be activated when the number of remaining (incomplete) pieces is smaller than the number of pending requests, which in its' turn is no greater than this value.
E.g. if the limit for concurrently active connections is 20, and there are in fact 20 peers that we are downloading from at the moment, then the endgame will begin as soon as there are 20 pieces left to download. At the same time if there are only 15 active connections, than the endgame will begin when there are 15 pieces left. Thus this value affects only the lower bound on the number of pieces to be left to trigger the beginning of an endgame.
maxConcurrentlyActivePeerConnectionsPerTorrent
- Maximum number of peer connections
that are allowed to request and receive pieces.public int getMaxConcurrentlyActivePeerConnectionsPerTorrent()
public void setMaxSimultaneouslyAssignedPieces(int maxSimultaneouslyAssignedPieces)
maxSimultaneouslyAssignedPieces
- the max number of pieces assigned to a single peerpublic int getMaxSimultaneouslyAssignedPieces()
public void setMaxPieceReceivingTime(Duration maxPieceReceivingTime)
maxPieceReceivingTime
- Limit on the amount of time it takes to receive all blocks in a piece
from a peer until this peer is considered timeouted and banned for a short
amount of time (with the piece being unassigned from this peer).public Duration getMaxPieceReceivingTime()
public void setMaxMessageProcessingInterval(Duration maxMessageProcessingInterval)
maxMessageProcessingInterval
- Maximum time to sleep between message processing loop iterations, in millis.MessageDispatcher
public Duration getMaxMessageProcessingInterval()
public void setUnreachablePeerBanDuration(Duration unreachablePeerBanDuration)
unreachablePeerBanDuration
- If a peer is not reachable (i.e. some kind of I/O error happens
when a connection attempt is made), then new requests to connect
to this peer will be ignored for this amount of time.public Duration getUnreachablePeerBanDuration()
public void setMaxPendingConnectionRequests(int maxPendingConnectionRequests)
maxPendingConnectionRequests
- Maximum allowed number of simultaneous connection requests
(both inbound and outbound). All subsequent requests will be queued
until some of the currently pending/processed requests is completed.public int getMaxPendingConnectionRequests()
public void setTimeoutedAssignmentPeerBanDuration(Duration timeoutedAssignmentPeerBanDuration)
timeoutedAssignmentPeerBanDuration
- Amount of time to keep the torrent processing session from
requesting a peer for new pieces if this peer's previous assignment
was cancelled due to a timeout.setMaxPieceReceivingTime(Duration)
public Duration getTimeoutedAssignmentPeerBanDuration()
public void setEncryptionPolicy(EncryptionPolicy encryptionPolicy)
encryptionPolicy
- Message Stream Encryption policypublic EncryptionPolicy getEncryptionPolicy()
public void setMetadataExchangeBlockSize(int metadataExchangeBlockSize)
metadataExchangeBlockSize
- BEP-9 transfer block sizepublic int getMetadataExchangeBlockSize()
public void setMetadataExchangeMaxSize(int metadataExchangeMaxSize)
metadataExchangeMaxSize
- Maximum allowed metadata size for BEP-9 transferpublic int getMetadataExchangeMaxSize()
public void setMsePrivateKeySize(int msePrivateKeySize)
msePrivateKeySize
- MSE private key size in bytes.
Allowed values are 16..512 bytes (128..4096 bits). Default is 20 bytes (160 bit).public int getMsePrivateKeySize()
public void setMseDisabled(boolean mseDisabled)
mseDisabled
- set true to disable mse, see MSEHandshakeProcessor
public boolean isMseDisabled()
public void setMseWaitBetweenReads(Duration mseWaitBetweenReads)
mseWaitBetweenReads
- Read timeout when doing mse handshake.
In good network environment, turning down this value may decrease mse handshake time cost.public Duration getMseWaitBetweenReads()
public void setNumberOfPeersToRequestFromTracker(int numberOfPeersToRequestFromTracker)
numberOfPeersToRequestFromTracker
- Number of peers to request from a trackerpublic int getNumberOfPeersToRequestFromTracker()
public void setMaxOutstandingRequests(int maxOutstandingRequests)
maxOutstandingRequests
- Limit on the number of outstanding requests to a peerpublic int getMaxOutstandingRequests()
public void setNetworkBufferSize(int networkBufferSize)
networkBufferSize
- Size of send and receive network buffers (in bytes)public int getNetworkBufferSize()
public int getHashingBufferSize()
public void setHashingBufferSize(int hashingBufferSize)
hashingBufferSize
- the size of the digest bufferCopyright © 2016–2021. All rights reserved.