Class: QuartzTorrent::Cancel
- Inherits:
-
PeerWireMessage
- Object
- PeerWireMessage
- QuartzTorrent::Cancel
- Defined in:
- lib/quartz_torrent/peermsg.rb
Overview
Cancel message. Cancel an outstanding request.
Constant Summary
Constants inherited from PeerWireMessage
PeerWireMessage::MessageBitfield, PeerWireMessage::MessageCancel, PeerWireMessage::MessageChoke, PeerWireMessage::MessageExtended, PeerWireMessage::MessageHave, PeerWireMessage::MessageInterested, PeerWireMessage::MessageKeepAlive, PeerWireMessage::MessagePiece, PeerWireMessage::MessageRequest, PeerWireMessage::MessageUnchoke, PeerWireMessage::MessageUninterested
Instance Attribute Summary collapse
-
#blockLength ⇒ Object
Returns the value of attribute blockLength.
-
#blockOffset ⇒ Object
Returns the value of attribute blockOffset.
-
#pieceIndex ⇒ Object
Returns the value of attribute pieceIndex.
Attributes inherited from PeerWireMessage
Instance Method Summary collapse
-
#initialize ⇒ Cancel
constructor
A new instance of Cancel.
- #payloadLength ⇒ Object
- #serializeTo(io) ⇒ Object
- #to_s ⇒ Object
- #unserialize(payload) ⇒ Object
Methods inherited from PeerWireMessage
Constructor Details
#initialize ⇒ Cancel
Returns a new instance of Cancel.
303 304 305 |
# File 'lib/quartz_torrent/peermsg.rb', line 303 def initialize super(MessageCancel) end |
Instance Attribute Details
#blockLength ⇒ Object
Returns the value of attribute blockLength.
309 310 311 |
# File 'lib/quartz_torrent/peermsg.rb', line 309 def blockLength @blockLength end |
#blockOffset ⇒ Object
Returns the value of attribute blockOffset.
308 309 310 |
# File 'lib/quartz_torrent/peermsg.rb', line 308 def blockOffset @blockOffset end |
#pieceIndex ⇒ Object
Returns the value of attribute pieceIndex.
307 308 309 |
# File 'lib/quartz_torrent/peermsg.rb', line 307 def pieceIndex @pieceIndex end |
Instance Method Details
#payloadLength ⇒ Object
311 312 313 |
# File 'lib/quartz_torrent/peermsg.rb', line 311 def payloadLength 12 end |
#serializeTo(io) ⇒ Object
315 316 317 318 |
# File 'lib/quartz_torrent/peermsg.rb', line 315 def serializeTo(io) super(io) io.write [@pieceIndex, @blockOffset, @blockLength].pack("NNN") end |
#to_s ⇒ Object
324 325 326 327 |
# File 'lib/quartz_torrent/peermsg.rb', line 324 def to_s s = super s + ": piece index=#{@pieceIndex}, block offset=#{@blockOffset}, block length=#{@blockLength}" end |
#unserialize(payload) ⇒ Object
320 321 322 |
# File 'lib/quartz_torrent/peermsg.rb', line 320 def unserialize(payload) @pieceIndex, @blockOffset, @blockLength = payload.unpack("NNN") end |