Package-level declarations

Types

Link copied to clipboard
data class AddTorrentAlert(val torrentName: String?, val errorMessage: String? = null, val errorCategory: String = "libtorrent") : TorrentAlert

Posted every time a torrent is successfully added (or fails to be added), carrying the result of the add operation. Ported from libtorrent::add_torrent_alert (alert_type 67).

Link copied to clipboard
abstract class Alert

The base class that every specific notification is derived from, ported from libtorrent::alert (include/libtorrent/alert.hpp).

Link copied to clipboard

Alert category bitmask, ported from libtorrent::alert_category together with the alert::*_notification static constants (include/libtorrent/alert.hpp).

Link copied to clipboard
data class BlockFinishedAlert(val torrentName: String?, val endpoint: String, val client: String = "Unknown", val pieceIndex: Int, val blockIndex: Int) : PeerAlert

Generated when a block request receives a response (the block finished downloading from this peer). Ported from libtorrent::block_finished_alert (alert_type 30). Extends PeerAlert.

Link copied to clipboard
data class DhtAnnounceAlert(val ip: String, val port: Int, val infoHash: Sha1Hash) : Alert

Generated when a DHT node announces to an info-hash on our DHT node. Ported from libtorrent::dht_announce_alert (alert_type 55).

Link copied to clipboard

Posted when the initial DHT bootstrap is done. Ported from libtorrent::dht_bootstrap_alert (alert_type 62). Carries no payload.

Link copied to clipboard
data class DhtGetPeersAlert(val infoHash: Sha1Hash) : Alert

Generated when a DHT node sends a get_peers message to our DHT node. Ported from libtorrent::dht_get_peers_alert (alert_type 56).

Link copied to clipboard
data class DhtReplyAlert(val torrentName: String?, val numPeers: Int) : TrackerAlert

Generated each time the DHT returns peers for a torrent. Ported from libtorrent::dht_reply_alert (alert_type 16). In libtorrent this derives from tracker_alert but is constructed with an empty URL and endpoint, and its message() omits the version/url, rendering only <prefix> received DHT peers: <n>.

Link copied to clipboard
data class ExternalIpAlert(val externalAddress: String) : Alert

Posted when libtorrent learns its external IP address (from a tracker or a peer supporting the extension protocol). Ported from libtorrent::external_ip_alert (alert_type 47).

Link copied to clipboard
data class FastresumeRejectedAlert(val torrentName: String?, val operation: String, val filePath: String, val errorMessage: String) : TorrentAlert

Generated when a fast-resume file is passed to add_torrent() but the on-disk files do not match it. Ported from libtorrent::fastresume_rejected_alert (alert_type 53).

Link copied to clipboard
data class FileCompletedAlert(val torrentName: String?, val index: Int) : TorrentAlert

Posted when an individual file completes downloading (all overlapping pieces have passed their hash check). Ported from libtorrent::file_completed_alert (alert_type 6).

Link copied to clipboard
data class FileErrorAlert(val torrentName: String?, val operation: String, val filename: String, val errorMessage: String) : TorrentAlert

Generated when the storage fails to read or write a file; the torrent is paused. Ported from libtorrent::file_error_alert (alert_type 43).

Link copied to clipboard
data class FileRenamedAlert(val torrentName: String?, val index: Int, val newName: String, val oldName: String) : TorrentAlert

Posted in response to rename_file() when the rename succeeds. Ported from libtorrent::file_renamed_alert (alert_type 7).

Link copied to clipboard
data class FileRenameFailedAlert(val torrentName: String?, val index: Int, val errorMessage: String) : TorrentAlert

Posted in response to rename_file() when the rename fails. Ported from libtorrent::file_rename_failed_alert (alert_type 8).

Link copied to clipboard
data class HashFailedAlert(val torrentName: String?, val pieceIndex: Int) : TorrentAlert

Generated when a finished piece fails its hash check. Ported from libtorrent::hash_failed_alert (alert_type 18).

Link copied to clipboard
data class IncomingConnectionAlert(val endpoint: String, val socketType: String = "TCP") : Alert

Posted every time an incoming connection is accepted (through any means). Ported from libtorrent::incoming_connection_alert (alert_type 66).

Link copied to clipboard
data class ListenFailedAlert(val listenInterface: String, val address: String, val port: Int, val operation: String, val socketType: String, val errorMessage: String, val endpoint: String = formatEndpoint(address, port)) : Alert

Posted when none of the ports in the listen range could be opened. Ported from libtorrent::listen_failed_alert (alert_type 48). Non-discardable.

Link copied to clipboard
data class ListenSucceededAlert(val address: String, val port: Int, val socketType: String = "TCP", val endpoint: String = formatEndpoint(address, port)) : Alert

Posted when the listen port succeeds to be opened on an interface. Ported from libtorrent::listen_succeeded_alert (alert_type 49). Non-discardable.

Link copied to clipboard
data class MetadataFailedAlert(val torrentName: String?) : TorrentAlert

Generated when received metadata fails to match the info-hash (corrupt metadata); libtorrent retries automatically. Ported from libtorrent::metadata_failed_alert (alert_type 44).

Link copied to clipboard
data class MetadataReceivedAlert(val torrentName: String?) : TorrentAlert

Generated when metadata has been fully received and can start downloading. Only fires for torrents that fetch metadata from peers. Ported from libtorrent::metadata_received_alert (alert_type 45).

Link copied to clipboard
abstract class PeerAlert : TorrentAlert

Base class for alerts referring to a specific peer, ported from libtorrent::peer_alert (include/libtorrent/alert_types.hpp).

Link copied to clipboard
data class PeerBanAlert(val torrentName: String?, val endpoint: String, val client: String = "Unknown") : PeerAlert

Generated when a peer is banned for sending too many corrupt pieces. Ported from libtorrent::peer_ban_alert (alert_type 19).

Link copied to clipboard
data class PeerBlockedAlert(val torrentName: String?, val endpoint: String, val reason: PeerBlockReason) : PeerAlert

Posted when an incoming peer (or one about to be added) is blocked, e.g. by the IP/port filter or protocol restrictions. Ported from libtorrent::peer_blocked_alert (alert_type 54). In libtorrent the peer id is always null for this alert.

Link copied to clipboard

The reason a peer was blocked, ported from libtorrent::peer_blocked_alert::reason_t. The label strings are the reason_str[] table from peer_blocked_alert::message().

Link copied to clipboard
data class PeerConnectAlert(val torrentName: String?, val endpoint: String, val client: String = "Unknown", val direction: PeerConnectDirection, val socketType: String = "TCP") : PeerAlert

Posted when an incoming connection passes the handshake and is associated with a torrent, or an outgoing connection attempt succeeds. Ported from libtorrent::peer_connect_alert (alert_type 23).

Link copied to clipboard

The direction of a peer connection, ported from libtorrent::peer_connect_alert::direction_t. Rendered as "incoming" / "outgoing" by peer_connect_alert::message().

Link copied to clipboard
data class PeerDisconnectedAlert(val torrentName: String?, val endpoint: String, val client: String = "Unknown", val socketType: String = "TCP", val operation: String = "bittorrent", val errorCategory: String = "system", val errorMessage: String, val reason: Int = 0) : PeerAlert

Generated when a peer is disconnected for any reason not covered by PeerErrorAlert. Ported from libtorrent::peer_disconnected_alert (alert_type 24).

Link copied to clipboard
data class PeerErrorAlert(val torrentName: String?, val endpoint: String, val client: String = "Unknown", val operation: String = "bittorrent", val errorCategory: String = "system", val errorMessage: String) : PeerAlert

Generated when a peer sends invalid data over the peer protocol and is disconnected. Ported from libtorrent::peer_error_alert (alert_type 22).

Link copied to clipboard
data class PeerSnubbedAlert(val torrentName: String?, val endpoint: String, val client: String = "Unknown") : PeerAlert

Generated when a peer is snubbed, because it stopped sending data we requested. Ported from libtorrent::peer_snubbed_alert (alert_type 21).

Link copied to clipboard
data class PeerUnsnubbedAlert(val torrentName: String?, val endpoint: String, val client: String = "Unknown") : PeerAlert

Generated when a snubbed peer starts sending data again. Ported from libtorrent::peer_unsnubbed_alert (alert_type 20).

Link copied to clipboard
data class PerformanceAlert(val torrentName: String?, val warning: PerformanceWarning) : TorrentAlert

Generated when a limit is reached that may hurt upload/download performance. Ported from libtorrent::performance_alert (alert_type 9).

Link copied to clipboard

Performance-warning codes, ported from libtorrent::performance_alert::performance_warning_t. The label strings are the warning_str[] table from performance_warning_str() in src/alert.cpp.

Link copied to clipboard
data class PieceFinishedAlert(val torrentName: String?, val pieceIndex: Int) : TorrentAlert

Posted every time a piece completes downloading and passes the hash check. Ported from libtorrent::piece_finished_alert (alert_type 27).

Link copied to clipboard

The BitTorrent protocol version carried by tracker alerts, ported from libtorrent::protocol_version (include/libtorrent/info_hash.hpp). libtorrent renders it as the literal "v1" or "v2" inside several tracker message()s.

Link copied to clipboard
data class ReadPieceAlert(val torrentName: String?, val pieceIndex: Int, val buffer: ByteArray? = null, val size: Int = 0, val errorMessage: String? = null) : TorrentAlert

Posted in response to read_piece() once the asynchronous read completes. Ported from libtorrent::read_piece_alert (alert_type 5). Non-discardable.

Link copied to clipboard
data class SaveResumeDataAlert(val torrentName: String?, val params: AddTorrentParams = AddTorrentParams()) : TorrentAlert

Generated as a response to save_resume_data() once the resume state has been written. Ported from libtorrent::save_resume_data_alert (alert_type 37).

Link copied to clipboard
data class SaveResumeDataFailedAlert(val torrentName: String?, val errorMessage: String) : TorrentAlert

Generated instead of SaveResumeDataAlert when resume-data generation failed. Ported from libtorrent::save_resume_data_failed_alert (alert_type 38).

Link copied to clipboard
data class ScrapeFailedAlert(val torrentName: String?, val trackerUrl: String, val localEndpoint: String, val errorMessage: String) : TrackerAlert

Generated when a scrape request fails (tracker timeout, refused connection or an HTTP error response). Ported from libtorrent::scrape_failed_alert (alert_type 14). Non-discardable.

Link copied to clipboard
data class ScrapeReplyAlert(val torrentName: String?, val trackerUrl: String, val localEndpoint: String, val incomplete: Int, val complete: Int, val version: ProtocolVersion = ProtocolVersion.V1) : TrackerAlert

Generated when a scrape request to a tracker succeeds. Ported from libtorrent::scrape_reply_alert (alert_type 13). Non-discardable.

Link copied to clipboard
data class SessionStatsAlert(val counters: LongArray) : Alert

Posted as a response to post_session_stats(). Carries a snapshot of all the session-wide counters. Ported from libtorrent::session_stats_alert (alert_type 70). Non-discardable.

Link copied to clipboard
data class StateChangedAlert(val torrentName: String?, val state: TorrentState, val prevState: TorrentState) : TorrentAlert

Generated whenever a torrent changes its state. Ported from libtorrent::state_changed_alert (alert_type 10).

Link copied to clipboard
data class StateUpdateAlert(val status: List<TorrentStatus>) : Alert

Posted in response to post_torrent_updates(), carrying the status of every torrent that changed since the last such post. Ported from libtorrent::state_update_alert (alert_type 68). Not subject to alert-mask filtering (it is only ever posted on request).

Link copied to clipboard
data class StorageMovedAlert(val torrentName: String?, val newPath: String, val oldPath: String) : TorrentAlert

Generated when all disk IO has completed and a torrent's files have been moved (after move_storage()). Ported from libtorrent::storage_moved_alert (alert_type 33).

Link copied to clipboard
data class StorageMovedFailedAlert(val torrentName: String?, val operation: String, val filePath: String, val errorMessage: String) : TorrentAlert

Generated when an attempt to move a torrent's storage fails. Ported from libtorrent::storage_moved_failed_alert (alert_type 34).

Link copied to clipboard
abstract class TorrentAlert : Alert

Base class for alerts associated with a specific torrent, ported from libtorrent::torrent_alert (include/libtorrent/alert_types.hpp).

Link copied to clipboard
data class TorrentCheckedAlert(val torrentName: String?) : TorrentAlert

Posted when a torrent finishes checking and is ready to start downloading. Ported from libtorrent::torrent_checked_alert (alert_type 41).

Link copied to clipboard
data class TorrentDeletedAlert(val torrentName: String?, val infoHash: Sha1Hash) : TorrentAlert

Generated when a request to delete a torrent's files completes. Ported from libtorrent::torrent_deleted_alert (alert_type 35).

Link copied to clipboard
data class TorrentDeleteFailedAlert(val torrentName: String?, val errorMessage: String, val infoHash: Sha1Hash) : TorrentAlert

Generated when a request to delete a torrent's files fails. Ported from libtorrent::torrent_delete_failed_alert (alert_type 36).

Link copied to clipboard
data class TorrentErrorAlert(val torrentName: String?, val errorValue: Int = 0, val errorMessage: String? = null, val filename: String = "") : TorrentAlert

Posted whenever a torrent is transitioned into the error state. Ported from libtorrent::torrent_error_alert (alert_type 64).

Link copied to clipboard
data class TorrentFinishedAlert(val torrentName: String?) : TorrentAlert

Posted when a torrent transitions from downloader to seed. Generated at most once per torrent. Ported from libtorrent::torrent_finished_alert (alert_type 26).

Link copied to clipboard
data class TorrentPausedAlert(val torrentName: String?) : TorrentAlert

Generated as a response to pause() once all disk IO is complete and files are closed. Ported from libtorrent::torrent_paused_alert (alert_type 39).

Link copied to clipboard
data class TorrentRemovedAlert(val torrentName: String?, val infoHash: Sha1Hash) : TorrentAlert

Posted whenever a torrent is removed. The torrent handle is usually already invalid, so the info-hash identifies it. Ported from libtorrent::torrent_removed_alert (alert_type 4).

Link copied to clipboard
data class TorrentResumedAlert(val torrentName: String?) : TorrentAlert

Generated as a response to resume() when a torrent goes from paused to active. Ported from libtorrent::torrent_resumed_alert (alert_type 40).

Link copied to clipboard

The torrent state, ported from libtorrent::torrent_status::state_t (include/libtorrent/torrent_status.hpp). The label strings match the state_str[] table used by state_changed_alert::message().

Link copied to clipboard
data class TorrentStatus(val infoHash: Sha1Hash, val state: TorrentState, val progress: Float = 0.0f, val totalDone: Long = 0, val downloadRate: Int = 0, val uploadRate: Int = 0, val numPeers: Int = 0, val numSeeds: Int = 0)

A minimal snapshot of a torrent's runtime state, the pure-Kotlin stand-in for the slice of libtorrent::torrent_status (include/libtorrent/torrent_status.hpp) that StateUpdateAlert carries. Only the headline fields clients typically poll are modelled; the full C++ struct has many more.

Link copied to clipboard
abstract class TrackerAlert : TorrentAlert

Base class for alerts associated with a specific tracker, ported from libtorrent::tracker_alert (include/libtorrent/alert_types.hpp). Derives from TorrentAlert because a tracker is always tied to a torrent.

Link copied to clipboard
data class TrackerAnnounceAlert(val torrentName: String?, val trackerUrl: String, val localEndpoint: String, val event: TrackerEvent, val version: ProtocolVersion = ProtocolVersion.V1) : TrackerAlert

Generated each time a tracker announce is sent (or attempted). Ported from libtorrent::tracker_announce_alert (alert_type 17).

Link copied to clipboard
data class TrackerErrorAlert(val torrentName: String?, val trackerUrl: String, val localEndpoint: String, val timesInRow: Int, val errorMessage: String, val failureReason: String = "", val version: ProtocolVersion = ProtocolVersion.V1) : TrackerAlert

Generated on tracker timeouts, premature disconnects, invalid responses or a non-200 OK HTTP response. Ported from libtorrent::tracker_error_alert (alert_type 11).

Link copied to clipboard

The tracker announce event, ported from libtorrent::event_t (include/libtorrent/tracker_manager.hpp). The label strings match the event_str[] table used by tracker_announce_alert::message().

Link copied to clipboard
data class TrackerReplyAlert(val torrentName: String?, val trackerUrl: String, val localEndpoint: String, val numPeers: Int, val version: ProtocolVersion = ProtocolVersion.V1) : TrackerAlert

Informational alert generated when a tracker announce succeeds (UDP, HTTP or DHT). Ported from libtorrent::tracker_reply_alert (alert_type 15).

Link copied to clipboard
data class TrackerWarningAlert(val torrentName: String?, val trackerUrl: String, val localEndpoint: String, val warningMessage: String, val version: ProtocolVersion = ProtocolVersion.V1) : TrackerAlert

Triggered when the tracker reply contains a warning field. The announce usually succeeded but the tracker has a message for the client. Ported from libtorrent::tracker_warning_alert (alert_type 12).

Link copied to clipboard
data class UdpErrorAlert(val address: String, val operation: String, val errorMessage: String) : Alert

Posted on a UDP socket error (uTP, DHT and UDP-tracker traffic is global to the session). Ported from libtorrent::udp_error_alert (alert_type 46).

Link copied to clipboard
data class UrlSeedAlert(val torrentName: String?, val serverUrl: String, val errorMessage: String) : TorrentAlert

Generated when an HTTP/web-seed name lookup or request fails. Ported from libtorrent::url_seed_alert (alert_type 42).