Skip to content

Commit

Permalink
fix: Segmentation Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-kp committed Aug 19, 2024
1 parent 92a0bda commit 90f29ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func Read(r io.Reader) (*Message, error) {
}
length := binary.BigEndian.Uint32(lengthBuf)

// keet the connection alive
// keep the connection alive
if length == 0 {
return nil, nil
}
Expand Down
5 changes: 4 additions & 1 deletion p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ func (state *pieceProgress) readMessage() error {
if err != nil {
return err
}

// keep alive connection
if msg == nil {
return nil
}
switch msg.ID {
case message.MsgUnchoke:
state.client.Choked = false
Expand Down

0 comments on commit 90f29ea

Please sign in to comment.