From a814f5106961c88d4f4f33d0adc0a754c546b553 Mon Sep 17 00:00:00 2001 From: Fu Wei <42842986+fuwei1217@users.noreply.github.com> Date: Thu, 27 Sep 2018 18:50:47 +0800 Subject: [PATCH] fix the panic issue in link.Rx() (#664) --- p2pserver/link/link.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/p2pserver/link/link.go b/p2pserver/link/link.go index 7997317e3a..554591dc36 100644 --- a/p2pserver/link/link.go +++ b/p2pserver/link/link.go @@ -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)