Browse Source

Networking fixes.

cl-refactor
Gav Wood 10 years ago
parent
commit
340801ed90
  1. 2
      alethzero/MainWin.cpp
  2. 2
      libdevcore/Common.cpp
  3. 2
      libethereum/EthereumHost.cpp
  4. 3
      libethereum/EthereumPeer.cpp
  5. 1
      libp2p/Common.h
  6. 4
      libp2p/Session.cpp
  7. 2
      test/TestHelper.cpp

2
alethzero/MainWin.cpp

@ -711,7 +711,7 @@ void Main::refreshNetwork()
ui->peerCount->setText(QString::fromStdString(toString(ps.size())) + " peer(s)");
ui->peers->clear();
for (PeerInfo const& i: ps)
ui->peers->addItem(QString("%3 ms - %1:%2 - %4 %5").arg(i.host.c_str()).arg(i.port).arg(chrono::duration_cast<chrono::milliseconds>(i.lastPing).count()).arg(i.clientVersion.c_str()).arg(QString::fromStdString(toString(i.caps))));
ui->peers->addItem(QString("[%6] %3 ms - %1:%2 - %4 %5").arg(i.host.c_str()).arg(i.port).arg(chrono::duration_cast<chrono::milliseconds>(i.lastPing).count()).arg(i.clientVersion.c_str()).arg(QString::fromStdString(toString(i.caps))).arg(i.socket));
}
void Main::refreshAll()

2
libdevcore/Common.cpp

@ -27,7 +27,7 @@ using namespace dev;
namespace dev
{
char const* Version = "0.6.9";
char const* Version = "0.6.10";
}

2
libethereum/EthereumHost.cpp

@ -265,6 +265,8 @@ void EthereumHost::maintainBlocks(BlockQueue& _bq, h256 _currentHash)
++c;
}
clog(NetMessageSummary) << "Sending" << c << "new blocks (current is" << _currentHash << ", was" << m_latestBlockSent << ")";
if (c > 1000)
cwarn << "Gaa sending an awful lot of new blocks. Sure this is right?";
ts.appendList(1 + c).append(BlocksPacket).appendRaw(bs, c);
bytes b;
ts.swapOut(b);

3
libethereum/EthereumPeer.cpp

@ -264,7 +264,8 @@ bool EthereumPeer::interpret(RLP const& _r)
unsigned unknownParents = 0;
if (g_logVerbosity >= NetMessageSummary::verbosity)
{
for (unsigned i = 1; i < _r.itemCount(); ++i)
unsigned ic = _r.itemCount();
for (unsigned i = 1; i < ic; ++i)
{
auto h = BlockInfo::headerHash(_r[i].data());
BlockInfo bi(_r[i].data());

1
libp2p/Common.h

@ -95,6 +95,7 @@ struct PeerInfo
unsigned short port;
std::chrono::steady_clock::duration lastPing;
std::set<std::string> caps;
unsigned socket;
};
}

4
libp2p/Session.cpp

@ -40,7 +40,7 @@ Session::Session(Host* _s, bi::tcp::socket _socket, bi::address _peerAddress, un
{
m_disconnect = std::chrono::steady_clock::time_point::max();
m_connect = std::chrono::steady_clock::now();
m_info = PeerInfo({"?", _peerAddress.to_string(), m_listenPort, std::chrono::steady_clock::duration(0)});
m_info = PeerInfo({"?", _peerAddress.to_string(), m_listenPort, std::chrono::steady_clock::duration(0), set<string>(), 0});
}
Session::~Session()
@ -102,7 +102,7 @@ bool Session::interpret(RLP const& _r)
return false;
}
try
{ m_info = PeerInfo({clientVersion, m_socket.remote_endpoint().address().to_string(), m_listenPort, std::chrono::steady_clock::duration(), _r[3].toSet<string>()}); }
{ m_info = PeerInfo({clientVersion, m_socket.remote_endpoint().address().to_string(), m_listenPort, std::chrono::steady_clock::duration(), _r[3].toSet<string>(), (unsigned)m_socket.native_handle()}); }
catch (...)
{
disconnect(BadProtocol);

2
test/TestHelper.cpp

@ -42,6 +42,8 @@ void mine(Client& c, int numBlocks)
void connectClients(Client& c1, Client& c2)
{
(void)c1;
(void)c2;
// TODO: Move to WebThree. eth::Client no longer handles networking.
#if 0
short c1Port = 20000;

Loading…
Cancel
Save