class QuartzTorrent::Have
Have
message. Sent to all connected peers to notify that we have completed downloading the specified piece.
Attributes
pieceIndex[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
QuartzTorrent::PeerWireMessage::new
# File lib/quartz_torrent/peermsg.rb, line 195 def initialize super(MessageHave) end
Public Instance Methods
payloadLength()
click to toggle source
# File lib/quartz_torrent/peermsg.rb, line 201 def payloadLength 4 end
serializeTo(io)
click to toggle source
Calls superclass method
QuartzTorrent::PeerWireMessage#serializeTo
# File lib/quartz_torrent/peermsg.rb, line 205 def serializeTo(io) super(io) io.write [@pieceIndex].pack("N") end
to_s()
click to toggle source
Calls superclass method
QuartzTorrent::PeerWireMessage#to_s
# File lib/quartz_torrent/peermsg.rb, line 214 def to_s s = super s + ": piece index=#{@pieceIndex}" end
unserialize(payload)
click to toggle source
# File lib/quartz_torrent/peermsg.rb, line 210 def unserialize(payload) @pieceIndex = payload.unpack("N")[0] end