Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche.h
// Copyright (c) 2018-2019 The Bitcoin developers | // Copyright (c) 2018-2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_AVALANCHE_H | #ifndef BITCOIN_AVALANCHE_H | ||||
#define BITCOIN_AVALANCHE_H | #define BITCOIN_AVALANCHE_H | ||||
#include <blockindexworkcomparator.h> | #include <blockindexworkcomparator.h> | ||||
#include <eventloop.h> | |||||
#include <key.h> | #include <key.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <protocol.h> // for CInv | #include <protocol.h> // for CInv | ||||
#include <rwcollection.h> | #include <rwcollection.h> | ||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <uint256.h> | #include <uint256.h> | ||||
#include <boost/multi_index/composite_key.hpp> | #include <boost/multi_index/composite_key.hpp> | ||||
#include <boost/multi_index/hashed_index.hpp> | #include <boost/multi_index/hashed_index.hpp> | ||||
#include <boost/multi_index/member.hpp> | #include <boost/multi_index/member.hpp> | ||||
#include <boost/multi_index/ordered_index.hpp> | #include <boost/multi_index/ordered_index.hpp> | ||||
#include <boost/multi_index_container.hpp> | #include <boost/multi_index_container.hpp> | ||||
#include <atomic> | #include <atomic> | ||||
#include <chrono> | #include <chrono> | ||||
#include <condition_variable> | |||||
#include <cstdint> | #include <cstdint> | ||||
#include <vector> | #include <vector> | ||||
class Config; | class Config; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class CScheduler; | class CScheduler; | ||||
namespace { | namespace { | ||||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | using QuerySet = boost::multi_index_container< | ||||
// sorted by timeout | // sorted by timeout | ||||
boost::multi_index::ordered_non_unique< | boost::multi_index::ordered_non_unique< | ||||
boost::multi_index::tag<query_timeout>, | boost::multi_index::tag<query_timeout>, | ||||
boost::multi_index::member<Query, TimePoint, | boost::multi_index::member<Query, TimePoint, | ||||
&Query::timeout>>>>; | &Query::timeout>>>>; | ||||
RWCollection<QuerySet> queries; | RWCollection<QuerySet> queries; | ||||
/** | /** The key used to sign responses. */ | ||||
* Start stop machinery. | |||||
*/ | |||||
std::atomic<bool> stopRequest; | |||||
bool running GUARDED_BY(cs_running); | |||||
Mutex cs_running; | |||||
std::condition_variable cond_running; | |||||
CKey sessionKey; | CKey sessionKey; | ||||
/** Event loop machinery. */ | |||||
EventLoop eventLoop; | |||||
public: | public: | ||||
AvalancheProcessor(CConnman *connmanIn); | AvalancheProcessor(CConnman *connmanIn); | ||||
~AvalancheProcessor(); | ~AvalancheProcessor(); | ||||
void setQueryTimeoutDuration(std::chrono::milliseconds d) { | void setQueryTimeoutDuration(std::chrono::milliseconds d) { | ||||
queryTimeoutDuration = d; | queryTimeoutDuration = d; | ||||
} | } | ||||
Show All 32 Lines |