Add comments

This commit is contained in:
Matt Joiner 2019-10-01 18:13:55 +10:00
parent efc1195ba2
commit 5b0c895e09
2 changed files with 4 additions and 2 deletions

View File

@ -1065,8 +1065,8 @@ func (c *connection) onReadRequest(r request) error {
return nil
}
// Processes incoming bittorrent messages. The client lock is held upon entry
// and exit. Returning will end the connection.
// Processes incoming BitTorrent wire-protocol messages. The client lock is held upon entry and
// exit. Returning will end the connection.
func (c *connection) mainReadLoop() (err error) {
defer func() {
if err != nil {

View File

@ -6,6 +6,8 @@ import (
"fmt"
)
// This is a lazy union representing all the possible fields for messages. Go doesn't have ADTs, and
// I didn't choose to use type-assertions.
type Message struct {
Keepalive bool
Type MessageType