mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-14 11:26:09 -05:00
![TheCharlatan](/assets/img/avatar_default.png)
This is an extraction of ArgsManager related functions from util/system into their own common file. Config file related functions are moved to common/config.cpp. The background of this commit is an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager. The ArgsManager belongs into the common library, since the kernel library should not depend on it. See doc/design/libraries.md for more information on this rationale.
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
// Copyright (c) 2021-2022 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <common/args.h>
|
|
#include <i2p.h>
|
|
#include <logging.h>
|
|
#include <netaddress.h>
|
|
#include <test/util/logging.h>
|
|
#include <test/util/net.h>
|
|
#include <test/util/setup_common.h>
|
|
#include <util/threadinterrupt.h>
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
BOOST_FIXTURE_TEST_SUITE(i2p_tests, BasicTestingSetup)
|
|
|
|
BOOST_AUTO_TEST_CASE(unlimited_recv)
|
|
{
|
|
const auto prev_log_level{LogInstance().LogLevel()};
|
|
LogInstance().SetLogLevel(BCLog::Level::Trace);
|
|
auto CreateSockOrig = CreateSock;
|
|
|
|
// Mock CreateSock() to create MockSock.
|
|
CreateSock = [](const CService&) {
|
|
return std::make_unique<StaticContentsSock>(std::string(i2p::sam::MAX_MSG_SIZE + 1, 'a'));
|
|
};
|
|
|
|
CThreadInterrupt interrupt;
|
|
i2p::sam::Session session(gArgs.GetDataDirNet() / "test_i2p_private_key", CService{}, &interrupt);
|
|
|
|
{
|
|
ASSERT_DEBUG_LOG("Creating persistent SAM session");
|
|
ASSERT_DEBUG_LOG("too many bytes without a terminator");
|
|
|
|
i2p::Connection conn;
|
|
bool proxy_error;
|
|
BOOST_REQUIRE(!session.Connect(CService{}, conn, proxy_error));
|
|
}
|
|
|
|
CreateSock = CreateSockOrig;
|
|
LogInstance().SetLogLevel(prev_log_level);
|
|
}
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|