Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
Remove unnecessary << operator overloading for CapDesc and update Host::startCapabilities to schedule each capability (via Host::scheduleCapabilityWorkLoop) rather post the work to the network thread (since the ~1s we save on network start via the post isn't noticeable in practice)
  • Loading branch information
halfalicious committed Mar 20, 2019
1 parent 185938f commit e4eb475
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
5 changes: 0 additions & 5 deletions libp2p/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ string reasonOf(DisconnectReason _r)
}
}

ostream& operator<<(ostream& _out, CapDesc const& _capDesc)
{
return _out << _capDesc.first << ": " << _capDesc.second;
}

void NodeIPEndpoint::streamRLP(RLPStream& _s, RLPAppend _append) const
{
if (_append == StreamList)
Expand Down
2 changes: 0 additions & 2 deletions libp2p/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ using CapDesc = std::pair<std::string, unsigned>;
using CapDescSet = std::set<CapDesc>;
using CapDescs = std::vector<CapDesc>;

std::ostream& operator<<(std::ostream& _out, CapDesc const& _capDesc);

/*
* Used by Host to pass negotiated information about a connection to a
* new Peer Session; PeerSessionInfo is then maintained by Session and can
Expand Down
7 changes: 1 addition & 6 deletions libp2p/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,7 @@ void Host::startCapabilities()
{
for (auto const& itCap : m_capabilities)
{
auto timer = itCap.second.backgroundWorkTimer;
auto cap = itCap.second.capability;
m_ioService.post([this, timer, cap]() {
cap->doBackgroundWork();
scheduleCapabilityWorkLoop(move(cap), move(timer));
});
scheduleCapabilityWorkLoop(itCap.second.capability, itCap.second.backgroundWorkTimer);
}
}

Expand Down

0 comments on commit e4eb475

Please sign in to comment.