mirror of
https://github.com/aria2/aria2.git
synced 2025-04-06 14:07:37 +03:00
Remove unused SimpleBtMessage::getMessageLength
This commit is contained in:
parent
a7237c69f7
commit
dae42d0cd0
21 changed files with 0 additions and 44 deletions
|
@ -113,8 +113,6 @@ std::vector<unsigned char> BtBitfieldMessage::createMessage()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BtBitfieldMessage::getMessageLength() { return 5 + bitfieldLength_; }
|
|
||||||
|
|
||||||
std::string BtBitfieldMessage::toString() const
|
std::string BtBitfieldMessage::toString() const
|
||||||
{
|
{
|
||||||
std::string s = NAME;
|
std::string s = NAME;
|
||||||
|
|
|
@ -68,8 +68,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE;
|
virtual std::string toString() const CXX11_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,14 +78,6 @@ std::vector<unsigned char> BtExtendedMessage::createMessage()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BtExtendedMessage::getMessageLength()
|
|
||||||
{
|
|
||||||
if (!msgLength_) {
|
|
||||||
msgLength_ = 6 + extensionMessage_->getPayload().size();
|
|
||||||
}
|
|
||||||
return msgLength_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BtExtendedMessage::sendPredicate() const
|
bool BtExtendedMessage::sendPredicate() const
|
||||||
{
|
{
|
||||||
return getPeer()->isExtendedMessagingEnabled();
|
return getPeer()->isExtendedMessagingEnabled();
|
||||||
|
|
|
@ -63,8 +63,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual bool sendPredicate() const CXX11_OVERRIDE;
|
virtual bool sendPredicate() const CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE;
|
virtual std::string toString() const CXX11_OVERRIDE;
|
||||||
|
|
|
@ -93,8 +93,6 @@ std::vector<unsigned char> BtHandshakeMessage::createMessage()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BtHandshakeMessage::getMessageLength() { return MESSAGE_LENGTH; }
|
|
||||||
|
|
||||||
std::string BtHandshakeMessage::toString() const
|
std::string BtHandshakeMessage::toString() const
|
||||||
{
|
{
|
||||||
return fmt("%s peerId=%s, reserved=%s", NAME,
|
return fmt("%s peerId=%s, reserved=%s", NAME,
|
||||||
|
|
|
@ -81,8 +81,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE;
|
virtual std::string toString() const CXX11_OVERRIDE;
|
||||||
|
|
||||||
bool isFastExtensionSupported() const;
|
bool isFastExtensionSupported() const;
|
||||||
|
|
|
@ -48,6 +48,4 @@ std::vector<unsigned char> BtKeepAliveMessage::createMessage()
|
||||||
return std::vector<unsigned char>(MESSAGE_LENGTH);
|
return std::vector<unsigned char>(MESSAGE_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BtKeepAliveMessage::getMessageLength() { return MESSAGE_LENGTH; }
|
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -54,8 +54,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE { return NAME; }
|
virtual std::string toString() const CXX11_OVERRIDE { return NAME; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,6 @@ std::vector<unsigned char> BtPortMessage::createMessage()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BtPortMessage::getMessageLength() { return MESSAGE_LENGTH; }
|
|
||||||
|
|
||||||
std::string BtPortMessage::toString() const
|
std::string BtPortMessage::toString() const
|
||||||
{
|
{
|
||||||
return fmt("%s port=%u", NAME, port_);
|
return fmt("%s port=%u", NAME, port_);
|
||||||
|
|
|
@ -73,8 +73,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE;
|
virtual std::string toString() const CXX11_OVERRIDE;
|
||||||
|
|
||||||
void setLocalNode(DHTNode* localNode);
|
void setLocalNode(DHTNode* localNode);
|
||||||
|
|
|
@ -53,8 +53,6 @@ std::vector<unsigned char> IndexBtMessage::createMessage()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t IndexBtMessage::getMessageLength() { return MESSAGE_LENGTH; }
|
|
||||||
|
|
||||||
std::string IndexBtMessage::toString() const
|
std::string IndexBtMessage::toString() const
|
||||||
{
|
{
|
||||||
return fmt("%s index=%lu", getName(), static_cast<unsigned long>(index_));
|
return fmt("%s index=%lu", getName(), static_cast<unsigned long>(index_));
|
||||||
|
|
|
@ -67,8 +67,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE;
|
virtual std::string toString() const CXX11_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,6 @@ std::vector<unsigned char> RangeBtMessage::createMessage()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RangeBtMessage::getMessageLength() { return MESSAGE_LENGTH; }
|
|
||||||
|
|
||||||
std::string RangeBtMessage::toString() const
|
std::string RangeBtMessage::toString() const
|
||||||
{
|
{
|
||||||
return fmt("%s index=%lu, begin=%d, length=%d", getName(),
|
return fmt("%s index=%lu, begin=%d, length=%d", getName(),
|
||||||
|
|
|
@ -77,8 +77,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE;
|
virtual std::string toString() const CXX11_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ void SimpleBtMessage::send()
|
||||||
getPeer()->getIPAddress().c_str(), getPeer()->getPort(),
|
getPeer()->getIPAddress().c_str(), getPeer()->getPort(),
|
||||||
toString().c_str()));
|
toString().c_str()));
|
||||||
auto msg = createMessage();
|
auto msg = createMessage();
|
||||||
size_t msgLength = getMessageLength();
|
|
||||||
A2_LOG_DEBUG(
|
A2_LOG_DEBUG(
|
||||||
fmt("msglength = %lu bytes", static_cast<unsigned long>(msg.size())));
|
fmt("msglength = %lu bytes", static_cast<unsigned long>(msg.size())));
|
||||||
getPeerConnection()->pushBytes(std::move(msg), getProgressUpdate());
|
getPeerConnection()->pushBytes(std::move(msg), getProgressUpdate());
|
||||||
|
|
|
@ -51,8 +51,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() = 0;
|
virtual std::vector<unsigned char> createMessage() = 0;
|
||||||
|
|
||||||
virtual size_t getMessageLength() = 0;
|
|
||||||
|
|
||||||
virtual std::unique_ptr<ProgressUpdate> getProgressUpdate();
|
virtual std::unique_ptr<ProgressUpdate> getProgressUpdate();
|
||||||
|
|
||||||
virtual bool sendPredicate() const { return true; };
|
virtual bool sendPredicate() const { return true; };
|
||||||
|
|
|
@ -54,8 +54,6 @@ std::vector<unsigned char> ZeroBtMessage::createMessage()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZeroBtMessage::getMessageLength() { return MESSAGE_LENGTH; }
|
|
||||||
|
|
||||||
std::string ZeroBtMessage::toString() const { return getName(); }
|
std::string ZeroBtMessage::toString() const { return getName(); }
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -58,8 +58,6 @@ public:
|
||||||
|
|
||||||
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
virtual std::vector<unsigned char> createMessage() CXX11_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t getMessageLength() CXX11_OVERRIDE;
|
|
||||||
|
|
||||||
virtual std::string toString() const CXX11_OVERRIDE;
|
virtual std::string toString() const CXX11_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,6 @@ void BtBitfieldMessageTest::testCreateMessage()
|
||||||
auto rawmsg = msg.createMessage();
|
auto rawmsg = msg.createMessage();
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)7, rawmsg.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)7, rawmsg.size());
|
||||||
CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
|
CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)7, msg.getMessageLength());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtBitfieldMessageTest::testDoReceivedAction()
|
void BtBitfieldMessageTest::testDoReceivedAction()
|
||||||
|
|
|
@ -81,7 +81,6 @@ void BtExtendedMessageTest::testCreateMessage()
|
||||||
auto rawmsg = msg.createMessage();
|
auto rawmsg = msg.createMessage();
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)17, rawmsg.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)17, rawmsg.size());
|
||||||
CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
|
CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)17, msg.getMessageLength());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtExtendedMessageTest::testDoReceivedAction()
|
void BtExtendedMessageTest::testDoReceivedAction()
|
||||||
|
|
|
@ -27,7 +27,6 @@ void BtKeepAliveMessageTest::testCreateMessage()
|
||||||
memset(data, 0, sizeof(data));
|
memset(data, 0, sizeof(data));
|
||||||
BtKeepAliveMessage message;
|
BtKeepAliveMessage message;
|
||||||
CPPUNIT_ASSERT_EQUAL((uint8_t)99, message.getId());
|
CPPUNIT_ASSERT_EQUAL((uint8_t)99, message.getId());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)4, message.getMessageLength());
|
|
||||||
auto rawmsg = message.createMessage();
|
auto rawmsg = message.createMessage();
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)4, rawmsg.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)4, rawmsg.size());
|
||||||
CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
|
CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue