|
@ -84,7 +84,7 @@ bool EthereumHost::ensureInitialised() |
|
|
|
|
|
|
|
|
void EthereumHost::reset() |
|
|
void EthereumHost::reset() |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (m_sync) |
|
|
if (m_sync) |
|
|
m_sync->abortSync(); |
|
|
m_sync->abortSync(); |
|
|
m_sync.reset(); |
|
|
m_sync.reset(); |
|
@ -118,7 +118,7 @@ void EthereumHost::doWork() |
|
|
|
|
|
|
|
|
if (m_syncStart) |
|
|
if (m_syncStart) |
|
|
{ |
|
|
{ |
|
|
DEV_GUARDED(x_sync) |
|
|
DEV_RECURSIVE_GUARDED(x_sync) |
|
|
if (!m_sync) |
|
|
if (!m_sync) |
|
|
{ |
|
|
{ |
|
|
time_t now = std::chrono::system_clock::to_time_t(chrono::system_clock::now()); |
|
|
time_t now = std::chrono::system_clock::to_time_t(chrono::system_clock::now()); |
|
@ -288,35 +288,35 @@ BlockChainSync* EthereumHost::sync() |
|
|
|
|
|
|
|
|
void EthereumHost::onPeerStatus(std::shared_ptr<EthereumPeer> _peer) |
|
|
void EthereumHost::onPeerStatus(std::shared_ptr<EthereumPeer> _peer) |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (sync()) |
|
|
if (sync()) |
|
|
sync()->onPeerStatus(_peer); |
|
|
sync()->onPeerStatus(_peer); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void EthereumHost::onPeerHashes(std::shared_ptr<EthereumPeer> _peer, h256s const& _hashes) |
|
|
void EthereumHost::onPeerHashes(std::shared_ptr<EthereumPeer> _peer, h256s const& _hashes) |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (sync()) |
|
|
if (sync()) |
|
|
sync()->onPeerHashes(_peer, _hashes); |
|
|
sync()->onPeerHashes(_peer, _hashes); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void EthereumHost::onPeerBlocks(std::shared_ptr<EthereumPeer> _peer, RLP const& _r) |
|
|
void EthereumHost::onPeerBlocks(std::shared_ptr<EthereumPeer> _peer, RLP const& _r) |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (sync()) |
|
|
if (sync()) |
|
|
sync()->onPeerBlocks(_peer, _r); |
|
|
sync()->onPeerBlocks(_peer, _r); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void EthereumHost::onPeerNewHashes(std::shared_ptr<EthereumPeer> _peer, h256s const& _hashes) |
|
|
void EthereumHost::onPeerNewHashes(std::shared_ptr<EthereumPeer> _peer, h256s const& _hashes) |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (sync()) |
|
|
if (sync()) |
|
|
sync()->onPeerNewHashes(_peer, _hashes); |
|
|
sync()->onPeerNewHashes(_peer, _hashes); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void EthereumHost::onPeerNewBlock(std::shared_ptr<EthereumPeer> _peer, RLP const& _r) |
|
|
void EthereumHost::onPeerNewBlock(std::shared_ptr<EthereumPeer> _peer, RLP const& _r) |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (sync()) |
|
|
if (sync()) |
|
|
sync()->onPeerNewBlock(_peer, _r); |
|
|
sync()->onPeerNewBlock(_peer, _r); |
|
|
} |
|
|
} |
|
@ -335,7 +335,7 @@ void EthereumHost::onPeerTransactions(std::shared_ptr<EthereumPeer> _peer, RLP c |
|
|
|
|
|
|
|
|
void EthereumHost::onPeerAborting() |
|
|
void EthereumHost::onPeerAborting() |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (m_sync) |
|
|
if (m_sync) |
|
@ -349,7 +349,7 @@ void EthereumHost::onPeerAborting() |
|
|
|
|
|
|
|
|
bool EthereumHost::isSyncing() const |
|
|
bool EthereumHost::isSyncing() const |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (!m_sync) |
|
|
if (!m_sync) |
|
|
return false; |
|
|
return false; |
|
|
return m_sync->isSyncing(); |
|
|
return m_sync->isSyncing(); |
|
@ -357,7 +357,7 @@ bool EthereumHost::isSyncing() const |
|
|
|
|
|
|
|
|
SyncStatus EthereumHost::status() const |
|
|
SyncStatus EthereumHost::status() const |
|
|
{ |
|
|
{ |
|
|
Guard l(x_sync); |
|
|
RecursiveGuard l(x_sync); |
|
|
if (!m_sync) |
|
|
if (!m_sync) |
|
|
return SyncStatus(); |
|
|
return SyncStatus(); |
|
|
return m_sync->status(); |
|
|
return m_sync->status(); |
|
|