diff --git a/src/BtConstants.h b/src/BtConstants.h index 16736847..c6b3e51b 100644 --- a/src/BtConstants.h +++ b/src/BtConstants.h @@ -46,7 +46,7 @@ constexpr size_t PIECE_HASH_LENGTH = 20; constexpr size_t PEER_ID_LENGTH = 20; -constexpr size_t MAX_BLOCK_LENGTH = 32_k; +constexpr size_t MAX_BLOCK_LENGTH = 64_k; constexpr size_t DEFAULT_MAX_OUTSTANDING_REQUEST = 6; diff --git a/test/BtRequestMessageTest.cc b/test/BtRequestMessageTest.cc index 1d3841cc..2177cef8 100644 --- a/test/BtRequestMessageTest.cc +++ b/test/BtRequestMessageTest.cc @@ -266,7 +266,7 @@ void BtRequestMessageTest::testValidate() void BtRequestMessageTest::testValidate_lengthTooLong() { - BtRequestMessage msg(0, 0, 32_k + 1); + BtRequestMessage msg(0, 0, MAX_BLOCK_LENGTH + 1); msg.setBtMessageValidator( make_unique(&msg, 1_k, 256_k)); try { @@ -274,7 +274,9 @@ void BtRequestMessageTest::testValidate_lengthTooLong() CPPUNIT_FAIL("exception must be thrown."); } catch (DlAbortEx& e) { - CPPUNIT_ASSERT_EQUAL(std::string("Length too long: 32769 > 32KB"), + CPPUNIT_ASSERT_EQUAL("Length too long: " + + util::uitos(MAX_BLOCK_LENGTH + 1) + " > " + + util::uitos(MAX_BLOCK_LENGTH / 1024) + "KB", std::string(e.what())); } } diff --git a/test/PeerConnectionTest.cc b/test/PeerConnectionTest.cc index f1d8374d..feb0f570 100644 --- a/test/PeerConnectionTest.cc +++ b/test/PeerConnectionTest.cc @@ -28,7 +28,7 @@ void PeerConnectionTest::testReserveBuffer() CPPUNIT_ASSERT_EQUAL((size_t)MAX_BUFFER_CAPACITY, con.getBufferCapacity()); CPPUNIT_ASSERT_EQUAL((size_t)3, con.getBufferLength()); - constexpr size_t newLength = 64_k; + constexpr size_t newLength = 128_k; con.reserveBuffer(newLength); CPPUNIT_ASSERT_EQUAL(newLength, con.getBufferCapacity());