CloseReason

Enum CloseReason 

Source
#[repr(u16)]
pub enum CloseReason {
Show 50 variants None = 0, DuplicatePeerId = 1, TorrentRemoved = 2, NoMemory = 3, PortBlocked = 4, Blocked = 5, UploadToUpload = 6, NotInterestedUploadOnly = 7, Timeout = 8, TimedOutInterest = 9, TimedOutActivity = 10, TimedOutHandshake = 11, TimedOutRequest = 12, ProtocolBlocked = 13, PeerChurn = 14, TooManyConnections = 15, TooManyFiles = 16, EncryptionError = 256, InvalidInfoHash = 257, SelfConnection = 258, InvalidMetadata = 259, MetadataTooBig = 260, MessageTooBig = 261, InvalidMessageId = 262, InvalidMessage = 263, InvalidPieceMessage = 264, InvalidHaveMessage = 265, InvalidBitfieldMessage = 266, InvalidChokeMessage = 267, InvalidUnchokeMessage = 268, InvalidInterestedMessage = 269, InvalidNotInterestedMessage = 270, InvalidRequestMessage = 271, InvalidRejectMessage = 272, InvalidAllowFastMessage = 273, InvalidExtendedMessage = 274, InvalidCancelMessage = 275, InvalidDhtPortMessage = 276, InvalidSuggestMessage = 277, InvalidHaveAllMessage = 278, InvalidDontHaveMessage = 279, InvalidHaveNoneMessage = 280, InvalidPexMessage = 281, InvalidMetadataRequestMessage = 282, InvalidMetadataMessage = 283, InvalidMetadataOffset = 284, RequestWhenChoked = 285, CorruptPieces = 286, PexMessageTooBig = 287, PexTooFrequent = 288,
}
Expand description

These are all the reasons to disconnect a peer all reasons caused by the peer sending unexpected data are 256 and up.

Variants§

§

None = 0

No reason specified. Generic close.

§

DuplicatePeerId = 1

We’re already connected to

§

TorrentRemoved = 2

This torrent has been removed, paused or stopped from this client.

§

NoMemory = 3

Client failed to allocate necessary memory for this peer connection

§

PortBlocked = 4

The source port of this peer is blocked

§

Blocked = 5

The source IP has been blocked

§

UploadToUpload = 6

Both ends of the connection are upload-only. staying connected would be redundant

§

NotInterestedUploadOnly = 7

Connection was closed because the other end is upload only and does not have any pieces we’re interested in

§

Timeout = 8

Peer connection timed out (generic timeout)

§

TimedOutInterest = 9

The peers have not been interested in each other for a very long time. disconnect

§

TimedOutActivity = 10

The peer has not sent any message in a long time.

§

TimedOutHandshake = 11

The peer did not complete the handshake in too long

§

TimedOutRequest = 12

The peer sent an interested message, but did not send a request after a very long time after being unchoked.

§

ProtocolBlocked = 13

The encryption mode is blocked

§

PeerChurn = 14

The peer was disconnected in the hopes of finding a better peer in the swarm

§

TooManyConnections = 15

We have too many peers connected

§

TooManyFiles = 16

We have too many file-descriptors open

§

EncryptionError = 256

The encryption handshake failed

§

InvalidInfoHash = 257

The info hash sent as part of the handshake was not what we expected

§

SelfConnection = 258

§

InvalidMetadata = 259

The metadata received matched the info-hash, but failed to parse. this is either someone finding a SHA1 collision, or the author of the magnet link creating it from an invalid torrent

§

MetadataTooBig = 260

The advertised metadata size

§

MessageTooBig = 261

Invalid bittorrent messages

§

InvalidMessageId = 262

§

InvalidMessage = 263

§

InvalidPieceMessage = 264

§

InvalidHaveMessage = 265

§

InvalidBitfieldMessage = 266

§

InvalidChokeMessage = 267

§

InvalidUnchokeMessage = 268

§

InvalidInterestedMessage = 269

§

InvalidNotInterestedMessage = 270

§

InvalidRequestMessage = 271

§

InvalidRejectMessage = 272

§

InvalidAllowFastMessage = 273

§

InvalidExtendedMessage = 274

§

InvalidCancelMessage = 275

§

InvalidDhtPortMessage = 276

§

InvalidSuggestMessage = 277

§

InvalidHaveAllMessage = 278

§

InvalidDontHaveMessage = 279

§

InvalidHaveNoneMessage = 280

§

InvalidPexMessage = 281

§

InvalidMetadataRequestMessage = 282

§

InvalidMetadataMessage = 283

§

InvalidMetadataOffset = 284

§

RequestWhenChoked = 285

The peer sent a request while being choked

§

CorruptPieces = 286

The peer sent corrupt data

§

PexMessageTooBig = 287

§

PexTooFrequent = 288

Trait Implementations§

Source§

impl Clone for CloseReason

Source§

fn clone(&self) -> CloseReason

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CloseReason

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for CloseReason

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for CloseReason

Source§

fn cmp(&self, other: &CloseReason) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for CloseReason

Source§

fn eq(&self, other: &CloseReason) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for CloseReason

Source§

fn partial_cmp(&self, other: &CloseReason) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for CloseReason

Source§

impl Eq for CloseReason

Source§

impl StructuralPartialEq for CloseReason

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.