# Configuration for 'slackware-14.2' seeds.

# Base settings
###############

# Base paths used in this configuration.
method.insert = cfg.basedir, private|const|string, "slackware-14.2/"
method.insert = cfg.seed, private|const|string, (cat, (cfg.basedir), "seed/")
method.insert = cfg.logs, private|const|string, (cat, (cfg.basedir), "logs/")
method.insert = cfg.session, private|const|string, (cat, (cfg.basedir), "session/")
method.insert = cfg.watch, private|const|string, (cat, (cfg.basedir), "watch/")

# Create instance directories if they don't already exist.
execute.throw = sh, -c, (cat,"mkdir -p \"",(cfg.seed),"\" ","\"",(cfg.logs),"\" ",\
    "\"",(cfg.session),"\" ","\"",(cfg.watch),"\"")

# Set the default directory.
directory.default.set = (cat, (cfg.seed))

# Store session data.
session.path.set = (cat, (cfg.session))
session.use_lock.set = yes

# Write a PID file.
execute.nothrow = sh, -c, (cat, "echo ", (system.pid), " >", (session.path), "rtorrent.pid")

# Remove file size limit.
system.file.max_size.set = -1

# Maximum memory for mapping file chunks.
# This refers to memory mapping, not physical memory allocation.
# 1GB.
pieces.memory.max.set = 1024M

# Preload a piece of a file.  Default: '0'.
# Possible values: '0' (Off), '1' (Madvise), '2' (Direct paging).
pieces.preload.type.set = 2
#pieces.preload.min_size.set = 262144
#pieces.preload.min_rate.set = 5120

# Send and receive buffer size for socket.
# Increasing buffer sizes may help reduce disk seeking and connection polling as more data
# is buffered each time the socket is written to, but it will result higher memory usage.
network.send_buffer.size.set = 12M
network.receive_buffer.size.set =  4M

# Pre-allocate file space.
system.file.allocate = 1


# Logging
#########
#  Levels = critical error warn notice info debug
#  Groups = connection_* dht_* peer_* rpc_* storage_* thread_* tracker_* torrent_*

# Open logfiles.
#log.open_file = "rtorrent", (cat, (cfg.logs), "rtorrent-", (system_time))
log.open_file = "rtorrent", (cat, (cfg.logs), "rtorrent")
#log.open_file = "tracker", (cat, (cfg.logs), "tracker")
#log.open_file = "storage", (cat, (cfg.logs), "storage")

# Define what's logged.
log.add_output = "critical", "rtorrent"
log.add_output = "error", "rtorrent"
log.add_output = "warn", "rtorrent"
log.add_output = "notice", "rtorrent"
log.add_output = "info", "rtorrent"
#log.add_output = "debug", "rtorrent"
#log.add_output = "dht_debug", "tracker"
#log.add_output = "tracker_debug", "tracker"
#log.add_output = "storage_debug", "storage"


# Connection settings
#####################

# The IP address the listening socket and outgoing connections are bound to.
network.bind_address.set = 91.109.244.10

# Port range to use for listening.
# This is the IANA-registered ephemeral port range.
network.port_range.set = 49152-65534

# Start opening ports at a random position within the port range.
network.port_random.set = yes

# Use DHT.
dht.mode.set = on
dht.port.set = 6881

# Bootstrap DHT with public servers.
schedule2 = dht_node_1, 2, 0, "dht.add_node=router.utorrent.com:6881"
schedule2 = dht_node_2, 2, 0, "dht.add_node=dht.transmissionbt.com:6881"
schedule2 = dht_node_3, 2, 0, "dht.add_node=tracker.opentrackr.org:1337"
schedule2 = dht_node_4, 2, 0, "dht.add_node=tracker.leechers-paradise.org:6969"
schedule2 = dht_node_5, 2, 0, "dht.add_node=9.rarbg.me:2710"
schedule2 = dht_node_6, 2, 0, "dht.add_node=tracker.torrent.eu.org:451"

# Enable peer-exchange.
protocol.pex.set = yes

# UDP tracker support.
trackers.use_udp.set = yes

# When to use encryption on the connection.
protocol.encryption.set = allow_incoming,try_outgoing,enable_retry

# Limits for file handle resources.
network.max_open_files.set = 4096
network.max_open_sockets.set = 4096

# Maximum number of simultaneous HTTP requests (used by announce or scrape requests).
network.http.max_open.set = 1024

# TOS of peer connections.
# Default is 'throughput'.  If the option is set to 'default' then the OS default TOS
# is used.  A hex value may be used for non-standard settings.
# Possible values: [default|lowdelay|throughput|reliability|mincost] or a hex value.
# network.tos.set = throughput

# CURL options to add support for nonofficial SSL trackers and peers.
network.http.ssl_verify_host.set = 0
network.http.ssl_verify_peer.set = 0

# CURL option to lower DNS timeout.  Default is '60'.
network.http.dns_cache_timeout.set = 25


# Throttling
############
# See: https://github.com/rakshasa/rtorrent/wiki/Performance-Tuning
# throttle.min_peers.normal.set and throttle.min_peers.seed.set where 1.

# Global upload and download rate in KiB. "0" for unlimited.
# These were set to 102400.
throttle.global_up.max_rate.set_kb = 0
throttle.global_down.max_rate.set_kb = 0

# Maximum number of global simultaneous *slots*.
throttle.max_uploads.global.set = 1024
throttle.max_downloads.global.set = 1024

# Maximum number of simultaneous *slots* per torrent.
throttle.max_uploads.set = 512
throttle.max_downloads.set = 512

# During normal operation, minimum and maximum number of peers to connect to per torrent.
throttle.min_peers.normal.set = 1024
throttle.max_peers.normal.set = 1024

# While seeding, minimum and maximum number of peers to connect to per torrent.
throttle.min_peers.seed.set = 1024
throttle.max_peers.seed.set = 1024


# Scheduled tasks
#################

# Monitor disk space, and close torrents if too little remains.
schedule2 = monitor_diskspace, 15, 60, ((close_low_diskspace, 1024M))

# Watch the 'cfg.watch' directory for torrents to load, and once loaded remove the file.
schedule2 = watch_start, 10, 10, ((load.start_verbose, (cat, (cfg.watch), "*.torrent"), "d.delete_tied="))
# schedule2 = watch_load, 11, 10, ((load.verbose, (cat, (cfg.watch), "*.torrent"), "d.delete_tied="))

# Stop torrents when reaching upload ratio in percent, when reaching total upload in bytes,
# or when reaching final upload ratio in percent.
# Example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0:
# schedule = ratio, 60, 60, stop_on_ratio=200,200M,2000


# Downloading
#############

# Check hash for finished torrents.
pieces.hash.on_completion.set = yes

# # Set the numwant field sent to the tracker, which indicates how many peers we want.
# Negative values disable feature.
trackers.numwant.set = 512


# Triggered tasks
#################

# Stop at ratio
#--------------
# Enable the default ratio group.
# ratio.enable=

# Set the limits.
# I believe the numbers here mean to seed to at least a 1.0 ratio,
# but no greater than 3.0 with a minimum upload size of 20M.
# ratio.min.set=100
# ratio.max.set=300
# ratio.upload.set=20M

# The command triggered when the ratio is reached.
# The default is "d.try_close= ; d.ignore_commands.set=1".
# method.set = group.seeding.ratio.command, "d.close= ; d.erase="

# Move completed torrents
#------------------------
# NOTE: Don't enable this on the seedbox!
# Define some methods.
#method.insert = d.get_finished_dir, simple, "cat=(cat,(cfg.complete)),$d.custom1="
#method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
#method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute2=mkdir,-p,$argument.1=; execute2=mv,-u,$argument.0=,$argument.1=;d.save_full_session="

# Set the action to invoke.
#method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir="



# May not be required
#####################

# system.umask.set = 0027
# system.cwd.set = (directory.default)


# throttle.max_downloads.div.set =
# max_downloads_div =

# throttle.max_uploads.div.set =
# max_uploads_div =


# pieces.sync.always_safe.set = no
# pieces.sync.timeout.set = 600
# pieces.sync.timeout_safe.set = 900


# system.file.split_size.set = -1
# system.file.split_suffix.set = .part


# session.on_completion.set = yes
