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 {
324
324
msg .Discard ()
325
325
go SendItems (p .rw , pongMsg )
326
326
case msg .Code == discMsg :
327
- var reason [1 ]DiscReason
328
327
// This is the last message. We don't need to discard or
329
328
// 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
332
332
case msg .Code < baseProtocolLength :
333
333
// ignore other base protocol messages
334
334
return msg .Discard ()
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func (pe *peerError) Error() string {
54
54
55
55
var errProtocolReturned = errors .New ("protocol returned" )
56
56
57
- type DiscReason uint
57
+ type DiscReason uint8
58
58
59
59
const (
60
60
DiscRequested DiscReason = iota
@@ -69,7 +69,7 @@ const (
69
69
DiscUnexpectedIdentity
70
70
DiscSelf
71
71
DiscReadTimeout
72
- DiscSubprotocolError = 0x10
72
+ DiscSubprotocolError = DiscReason ( 0x10 )
73
73
)
74
74
75
75
var discReasonToString = [... ]string {
You can’t perform that action at this time.
0 commit comments