1
0
mirror of https://github.com/veggiedefender/torrent-client.git synced 2025-11-06 09:29:16 +02:00

More informative comments for message IDs

This commit is contained in:
Jesse Li
2020-01-02 12:29:10 -05:00
parent b3beb5ed2a
commit 81a6437145

View File

@@ -9,18 +9,25 @@ import (
type messageID uint8 type messageID uint8
// Message ID
const ( const (
MsgChoke messageID = 0 // MsgChoke chokes the receiver
MsgUnchoke messageID = 1 MsgChoke messageID = 0
MsgInterested messageID = 2 // MsgUnchoke unchokes the receiver
MsgUnchoke messageID = 1
// MsgInterested expresses interest in receiving data
MsgInterested messageID = 2
// MsgNotInterested expresses disinterest in receiving data
MsgNotInterested messageID = 3 MsgNotInterested messageID = 3
MsgHave messageID = 4 // MsgHave alerts the receiver that the sender has downloaded a piece
MsgBitfield messageID = 5 MsgHave messageID = 4
MsgRequest messageID = 6 // MsgBitfield encodes which pieces that the sender has downloaded
MsgPiece messageID = 7 MsgBitfield messageID = 5
MsgCancel messageID = 8 // MsgRequest requests a block of data from the receiver
MsgPort messageID = 9 MsgRequest messageID = 6
// MsgPiece delivers a block of data to fulfill a request
MsgPiece messageID = 7
// MsgCancel cancels a request
MsgCancel messageID = 8
) )
// Message stores ID and payload of a message // Message stores ID and payload of a message