Browse Source

Block hash download fix.

cl-refactor
Gav Wood 10 years ago
parent
commit
95c063202c
  1. 13
      libethereum/EthereumHost.cpp
  2. 18
      libwhisper/WhisperPeer.cpp

13
libethereum/EthereumHost.cpp

@ -74,12 +74,19 @@ void EthereumHost::noteHavePeerState(EthereumPeer* _who)
{
clog(NetAllDetail) << "Have peer state.";
// TODO: FIX: BUG: Better state management!
// if already downloading hash-chain, ignore.
if (m_grabbing != Grabbing::Nothing)
{
clog(NetAllDetail) << "Already downloading chain. Just set to help out.";
_who->ensureGettingChain();
return;
for (auto const& i: peers())
if (i->cap<EthereumPeer>()->m_grabbing == m_grabbing || m_grabbing == Grabbing::State)
{
clog(NetAllDetail) << "Already downloading chain. Just set to help out.";
_who->ensureGettingChain();
return;
}
m_grabbing = Grabbing::Nothing;
}
// otherwise check to see if we should be downloading...

18
libwhisper/WhisperPeer.cpp

@ -92,15 +92,17 @@ void WhisperPeer::sendMessages()
n++;
}
// pause before sending if no messages to send
if (!n)
if (n)
{
RLPStream s;
prep(s);
s.appendList(n + 1) << MessagesPacket;
s.appendRaw(amalg.out(), n);
sealAndSend(s);
}
else
// just pause if no messages to send
this_thread::sleep_for(chrono::milliseconds(100));
RLPStream s;
prep(s);
s.appendList(n + 1) << MessagesPacket;
s.appendRaw(amalg.out(), n);
sealAndSend(s);
}
void WhisperPeer::noteNewMessage(h256 _h, Message const& _m)

Loading…
Cancel
Save