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. 10
      libethereum/PeerSession.cpp
  4. 4
      walleth/MainWin.cpp

57
alethzero/Main.ui

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

2
alethzero/MainWin.cpp

@ -1266,7 +1266,7 @@ void Main::on_net_triggered()
m_client->setClientVersion(n); m_client->setClientVersion(n);
if (ui->net->isChecked()) 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()) if (m_peers.size() && ui->usePast->isChecked())
m_client->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size())); m_client->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size()));
} }

10
libethereum/PeerSession.cpp

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

4
walleth/MainWin.cpp

@ -243,10 +243,10 @@ void Main::on_net_triggered(bool _auto)
if (_auto) if (_auto)
{ {
QString s = m_servers[rand() % m_servers.size()]; 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 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()) if (m_peers.size())
client()->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size())); client()->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size()));
} }

Loading…
Cancel
Save