/* */ #include "IndexBtMessage.h" #include "util.h" #include "a2functional.h" #include "bittorrent_helper.h" namespace aria2 { std::vector IndexBtMessage::createMessage() { /** * len --- 5, 4bytes * id --- ?, 1byte * piece index --- index, 4bytes * total: 9bytes */ auto msg = std::vector(MESSAGE_LENGTH); bittorrent::createPeerMessageString(msg.data(), MESSAGE_LENGTH, 5, getId()); bittorrent::setIntParam(&msg[5], index_); return msg; } std::string IndexBtMessage::toString() const { return fmt("%s index=%lu", getName(), static_cast(index_)); } } // namespace aria2