]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add peer_protocol.RequestSpec
authorMatt Joiner <anacrolix@gmail.com>
Wed, 11 Jul 2018 23:16:17 +0000 (09:16 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 11 Jul 2018 23:16:17 +0000 (09:16 +1000)
peer_protocol/msg.go
peer_protocol/reqspec.go [new file with mode: 0644]

index 476a54c0f11ce35c3697c53b1b8fc617710ebf93..7d3764b714223cafe832cc73b7a8f708694cf968 100644 (file)
@@ -26,6 +26,10 @@ func MakeCancelMessage(piece, offset, length Integer) Message {
        }
 }
 
+func (msg Message) RequestSpec() RequestSpec {
+       return RequestSpec{msg.Index, msg.Begin, msg.Length}
+}
+
 func (msg Message) MustMarshalBinary() []byte {
        b, err := msg.MarshalBinary()
        if err != nil {
diff --git a/peer_protocol/reqspec.go b/peer_protocol/reqspec.go
new file mode 100644 (file)
index 0000000..f73a66d
--- /dev/null
@@ -0,0 +1,5 @@
+package peer_protocol
+
+type RequestSpec struct {
+       Index, Begin, Length Integer
+}