Browse Source

More network fixes.

cl-refactor
Gav Wood 11 years ago
parent
commit
8d65de7e28
  1. 57
      alethzero/Main.ui
  2. 2
      alethzero/MainWin.cpp
  3. 14
      libethereum/PeerSession.cpp
  4. 4
      walleth/MainWin.cpp

57
alethzero/Main.ui

@ -269,7 +269,7 @@
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<item row="1" column="2">
<widget class="QSpinBox" name="port">
<property name="minimum">
<number>1024</number>
@ -282,53 +282,66 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="idealPeers">
<property name="minimum">
<number>1</number>
<item row="1" column="1">
<widget class="QLineEdit" name="forceAddress">
<property name="inputMask">
<string/>
</property>
<property name="value">
<number>5</number>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Automatic</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Ideal &amp;Peers</string>
<string>&amp;Listen on</string>
</property>
<property name="buddy">
<cstring>idealPeers</cstring>
<cstring>port</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;Client Name</string>
<string>Ideal &amp;Peers</string>
</property>
<property name="buddy">
<cstring>clientName</cstring>
<cstring>idealPeers</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Listen on</string>
<item row="0" column="1" colspan="2">
<widget class="QSpinBox" name="idealPeers">
<property name="minimum">
<number>1</number>
</property>
<property name="buddy">
<cstring>port</cstring>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="clientName">
<property name="placeholderText">
<string>Anonymous</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>&amp;Client Name</string>
</property>
<property name="buddy">
<cstring>clientName</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

2
alethzero/MainWin.cpp

@ -1266,7 +1266,7 @@ void Main::on_net_triggered()
m_client->setClientVersion(n);
if (ui->net->isChecked())
{
m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, ui->idealPeers->value(), std::string(), ui->upnp->isChecked());
m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, ui->idealPeers->value(), ui->forceAddress->text().toStdString(), ui->upnp->isChecked());
if (m_peers.size() && ui->usePast->isChecked())
m_client->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size()));
}

14
libethereum/PeerSession.cpp

@ -50,16 +50,12 @@ PeerSession::PeerSession(PeerServer* _s, bi::tcp::socket _socket, uint _rNId, bi
PeerSession::~PeerSession()
{
m_strand.post([=]()
try
{
if (!m_writeQueue.empty())
m_writeQueue.clear();
try {
if (m_socket.is_open())
m_socket.close();
}catch (...){}
});
if (m_socket.is_open())
m_socket.close();
}
catch (...){}
}
bi::tcp::endpoint PeerSession::endpoint() const

4
walleth/MainWin.cpp

@ -243,10 +243,10 @@ void Main::on_net_triggered(bool _auto)
if (_auto)
{
QString s = m_servers[rand() % m_servers.size()];
client()->startNetwork(m_port, s.section(':', 0, 0).toStdString(), s.section(':', 1).toInt(), NodeMode::Full, m_idealPeers, std::string(), ui->upnp->isChecked());
client()->startNetwork(m_port, s.section(':', 0, 0).toStdString(), s.section(':', 1).toInt(), NodeMode::Full, m_idealPeers, "", ui->upnp->isChecked());
}
else
client()->startNetwork(m_port, string(), 0, NodeMode::Full, m_idealPeers, std::string(), ui->upnp->isChecked());
client()->startNetwork(m_port, string(), 0, NodeMode::Full, m_idealPeers, "", ui->upnp->isChecked());
if (m_peers.size())
client()->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size()));
}

Loading…
Cancel
Save