Skip to content

Commit

Permalink
fix the panic issue in link.Rx() (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuwei1217 authored and laizy committed Sep 27, 2018
1 parent f5219c7 commit a814f51
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion p2pserver/link/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ func (this *Link) GetRXTime() time.Time {
}

func (this *Link) Rx() {
reader := bufio.NewReaderSize(this.conn, common.MAX_BUF_LEN)
conn := this.conn
if conn == nil {
return
}

reader := bufio.NewReaderSize(conn, common.MAX_BUF_LEN)

for {
msg, payloadSize, err := types.ReadMessage(reader)
Expand Down

0 comments on commit a814f51

Please sign in to comment.