From 5b0c895e09be3cc026c13bccdb140a20bb77e670 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 1 Oct 2019 18:13:55 +1000 Subject: [PATCH] Add comments --- connection.go | 4 ++-- peer_protocol/msg.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/connection.go b/connection.go index f063054f..289d20a8 100644 --- a/connection.go +++ b/connection.go @@ -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 { diff --git a/peer_protocol/msg.go b/peer_protocol/msg.go index d7e5f5a7..c0d94e37 100644 --- a/peer_protocol/msg.go +++ b/peer_protocol/msg.go @@ -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 -- 2.48.1