File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -324,11 +324,11 @@ func (p *Peer) handle(msg Msg) error {
324324 msg .Discard ()
325325 go SendItems (p .rw , pongMsg )
326326 case msg .Code == discMsg :
327- var reason [1 ]DiscReason
328327 // This is the last message. We don't need to discard or
329328 // check errors because, the connection will be closed after it.
330- rlp .Decode (msg .Payload , & reason )
331- return reason [0 ]
329+ var m struct { R DiscReason }
330+ rlp .Decode (msg .Payload , & m )
331+ return m .R
332332 case msg .Code < baseProtocolLength :
333333 // ignore other base protocol messages
334334 return msg .Discard ()
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func (pe *peerError) Error() string {
5454
5555var errProtocolReturned = errors .New ("protocol returned" )
5656
57- type DiscReason uint
57+ type DiscReason uint8
5858
5959const (
6060 DiscRequested DiscReason = iota
@@ -69,7 +69,7 @@ const (
6969 DiscUnexpectedIdentity
7070 DiscSelf
7171 DiscReadTimeout
72- DiscSubprotocolError = 0x10
72+ DiscSubprotocolError = DiscReason ( 0x10 )
7373)
7474
7575var discReasonToString = [... ]string {
You can’t perform that action at this time.
0 commit comments