mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Refactor NetworkOPs:
* Reduce public API * Use LedgerMaster interface from RPC * Remove fetch pack management to LedgerMaster
This commit is contained in:
@@ -539,7 +539,7 @@ PeerImp::onTimer (error_code const& ec)
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have an outstanding ping, raise latency
|
||||
// We have an outstanding ping, raise latency
|
||||
auto minLatency = std::chrono::duration_cast <std::chrono::milliseconds>
|
||||
(clock_type::now() - lastPingTime_);
|
||||
|
||||
@@ -1572,7 +1572,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
|
||||
"GetObj: Full fetch pack for " << pLSeq;
|
||||
|
||||
pLSeq = obj.ledgerseq ();
|
||||
pLDo = !getApp().getOPs ().haveLedger (pLSeq);
|
||||
pLDo = !getApp().getLedgerMaster ().haveLedger (pLSeq);
|
||||
|
||||
if (!pLDo)
|
||||
p_journal_.debug <<
|
||||
@@ -1591,7 +1591,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
|
||||
std::make_shared< Blob > (
|
||||
obj.data ().begin (), obj.data ().end ()));
|
||||
|
||||
getApp().getOPs ().addFetchPack (hash, data);
|
||||
getApp().getLedgerMaster ().addFetchPack (hash, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1601,7 +1601,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
|
||||
p_journal_.debug << "GetObj: Partial fetch pack for " << pLSeq;
|
||||
|
||||
if (packet.type () == protocol::TMGetObjectByHash::otFETCH_PACK)
|
||||
getApp().getOPs ().gotFetchPack (progress, pLSeq);
|
||||
getApp().getLedgerMaster ().gotFetchPack (progress, pLSeq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1681,7 +1681,7 @@ PeerImp::doFetchPack (const std::shared_ptr<protocol::TMGetObjectByHash>& packet
|
||||
memcpy (hash.begin (), packet->ledgerhash ().data (), 32);
|
||||
|
||||
getApp().getJobQueue ().addJob (jtPACK, "MakeFetchPack",
|
||||
std::bind (&NetworkOPs::makeFetchPack, &getApp().getOPs (),
|
||||
std::bind (&LedgerMaster::makeFetchPack, &getApp().getLedgerMaster (),
|
||||
std::placeholders::_1, std::weak_ptr<PeerImp> (shared_from_this ()),
|
||||
packet, hash, UptimeTimer::getInstance ().getElapsedSeconds ()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user