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

Incredibly messy and slow download

This commit is contained in:
Jesse
2019-12-26 21:53:11 -05:00
parent b1fc8c7fb8
commit 7e8cac2d3e
8 changed files with 290 additions and 46 deletions

View File

@@ -1,6 +1,7 @@
package handshake
import (
"bufio"
"errors"
"io"
)
@@ -35,7 +36,7 @@ func (h *Handshake) Serialize() []byte {
}
// Read parses a message from a stream. Returns `nil` on keep-alive message
func Read(r io.Reader) (*Handshake, error) {
func Read(r *bufio.Reader) (*Handshake, error) {
lengthBuf := make([]byte, 1)
_, err := io.ReadFull(r, lengthBuf)
if err != nil {