You've already forked torrent-client
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user