class QuartzTorrent::BitfieldMessage
Bitfield
message. Sent on initial handshake to notify peer of what pieces we have.
Attributes
bitfield[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
QuartzTorrent::PeerWireMessage::new
# File lib/quartz_torrent/peermsg.rb, line 222 def initialize super(MessageBitfield) end
Public Instance Methods
payloadLength()
click to toggle source
# File lib/quartz_torrent/peermsg.rb, line 228 def payloadLength bitfield.byteLength end
serializeTo(io)
click to toggle source
Calls superclass method
QuartzTorrent::PeerWireMessage#serializeTo
# File lib/quartz_torrent/peermsg.rb, line 232 def serializeTo(io) super(io) io.write @bitfield.serialize end
unserialize(payload)
click to toggle source
# File lib/quartz_torrent/peermsg.rb, line 237 def unserialize(payload) @bitfield = Bitfield.new(payload.length*8) if ! @bitfield @bitfield.unserialize(payload) end