2
0
mirror of synced 2025-02-23 14:18:13 +00:00

request can be made from Reject and Cancel messages too

This commit is contained in:
Matt Joiner 2018-02-02 23:56:06 +11:00
parent 89b17c4372
commit ffe778392c

View File

@ -23,7 +23,7 @@ func newRequest(index, begin, length pp.Integer) request {
func newRequestFromMessage(msg *pp.Message) request {
switch msg.Type {
case pp.Request:
case pp.Request, pp.Cancel, pp.Reject:
return newRequest(msg.Index, msg.Begin, msg.Length)
case pp.Piece:
return newRequest(msg.Index, msg.Begin, pp.Integer(len(msg.Piece)))