Browse Source

s/ushort/unsigned short/ since ushort isn't actually defined.

cl-refactor
Tim Hughes 11 years ago
parent
commit
4ab877de5e
  1. 2
      alethzero/MainWin.cpp
  2. 4
      eth/main.cpp
  3. 4
      libethereum/Client.cpp
  4. 4
      libethereum/Client.h
  5. 8
      libethereum/PeerNetwork.cpp
  6. 14
      libethereum/PeerNetwork.h

2
alethzero/MainWin.cpp

@ -279,7 +279,7 @@ void Main::on_connect_triggered()
if (ok && s.contains(":"))
{
string host = s.section(":", 0, 0).toStdString();
ushort port = s.section(":", 1).toInt();
unsigned short port = s.section(":", 1).toInt();
m_client->connect(host, port);
}
}

4
eth/main.cpp

@ -99,9 +99,9 @@ void version()
int main(int argc, char** argv)
{
ushort listenPort = 30303;
unsigned short listenPort = 30303;
string remoteHost;
ushort remotePort = 30303;
unsigned short remotePort = 30303;
bool interactive = false;
string dbPath;
eth::uint mining = ~(eth::uint)0;

4
libethereum/Client.cpp

@ -60,7 +60,7 @@ Client::~Client()
this_thread::sleep_for(chrono::milliseconds(10));
}
void Client::startNetwork(ushort _listenPort, std::string const& _seedHost, ushort _port, NodeMode _mode, unsigned _peers, string const& _publicIP, bool _upnp)
void Client::startNetwork(unsigned short _listenPort, std::string const& _seedHost, unsigned short _port, NodeMode _mode, unsigned _peers, string const& _publicIP, bool _upnp)
{
if (m_net)
return;
@ -70,7 +70,7 @@ void Client::startNetwork(ushort _listenPort, std::string const& _seedHost, usho
connect(_seedHost, _port);
}
void Client::connect(std::string const& _seedHost, ushort _port)
void Client::connect(std::string const& _seedHost, unsigned short _port)
{
if (!m_net)
return;

4
libethereum/Client.h

@ -106,9 +106,9 @@ public:
unsigned peerCount() const { return m_net ? m_net->peerCount() : 0; }
/// Start the network subsystem.
void startNetwork(ushort _listenPort = 30303, std::string const& _seedHost = std::string(), ushort _port = 30303, NodeMode _mode = NodeMode::Full, unsigned _peers = 5, std::string const& _publicIP = std::string(), bool _upnp = true);
void startNetwork(unsigned short _listenPort = 30303, std::string const& _seedHost = std::string(), unsigned short _port = 30303, NodeMode _mode = NodeMode::Full, unsigned _peers = 5, std::string const& _publicIP = std::string(), bool _upnp = true);
/// Connect to a particular peer.
void connect(std::string const& _seedHost, ushort _port = 30303);
void connect(std::string const& _seedHost, unsigned short _port = 30303);
/// Stop the network subsystem.
void stopNetwork();
/// Get access to the peer server object. This will be null if the network isn't online.

8
libethereum/PeerNetwork.cpp

@ -80,7 +80,7 @@ bool eth::isPrivateAddress(bi::address _addressToCheck)
return false;
}
PeerSession::PeerSession(PeerServer* _s, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, ushort _peerPort):
PeerSession::PeerSession(PeerServer* _s, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, unsigned short _peerPort):
m_server(_s),
m_socket(std::move(_socket)),
m_reqNetworkId(_rNId),
@ -137,7 +137,7 @@ bool PeerSession::interpret(RLP const& _r)
m_networkId = _r[2].toInt<uint>();
auto clientVersion = _r[3].toString();
m_caps = _r[4].toInt<uint>();
m_listenPort = _r[5].toInt<ushort>();
m_listenPort = _r[5].toInt<unsigned short>();
m_id = _r[6].toHash<h512>();
clogS(NetMessageSummary) << "Hello: " << clientVersion << "V[" << m_protocolVersion << "/" << m_networkId << "]" << m_id.abridged() << showbase << hex << m_caps << dec << m_listenPort;
@ -635,7 +635,7 @@ void PeerSession::doRead()
});
}
PeerServer::PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, ushort _port, NodeMode _m, string const& _publicAddress, bool _upnp):
PeerServer::PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, unsigned short _port, NodeMode _m, string const& _publicAddress, bool _upnp):
m_clientVersion(_clientVersion),
m_mode(_m),
m_listenPort(_port),
@ -831,7 +831,7 @@ void PeerServer::ensureAccepting()
}
}
void PeerServer::connect(std::string const& _addr, ushort _port) noexcept
void PeerServer::connect(std::string const& _addr, unsigned short _port) noexcept
{
try
{

14
libethereum/PeerNetwork.h

@ -82,7 +82,7 @@ struct PeerInfo
{
std::string clientVersion;
std::string host;
ushort port;
unsigned short port;
std::chrono::steady_clock::duration lastPing;
};
@ -91,7 +91,7 @@ class PeerSession: public std::enable_shared_from_this<PeerSession>
friend class PeerServer;
public:
PeerSession(PeerServer* _server, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, ushort _peerPort = 0);
PeerSession(PeerServer* _server, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, unsigned short _peerPort = 0);
~PeerSession();
void start();
@ -127,7 +127,7 @@ private:
uint m_protocolVersion;
uint m_networkId;
uint m_reqNetworkId;
ushort m_listenPort; ///< Port that the remote client is listening on for connections. Useful for giving to peers.
unsigned short m_listenPort; ///< Port that the remote client is listening on for connections. Useful for giving to peers.
uint m_caps;
std::chrono::steady_clock::time_point m_ping;
@ -155,13 +155,13 @@ class PeerServer
public:
/// Start server, listening for connections on the given port.
PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, ushort _port, NodeMode _m = NodeMode::Full, std::string const& _publicAddress = std::string(), bool _upnp = true);
PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, unsigned short _port, NodeMode _m = NodeMode::Full, std::string const& _publicAddress = std::string(), bool _upnp = true);
/// Start server, but don't listen.
PeerServer(std::string const& _clientVersion, uint _networkId, NodeMode _m = NodeMode::Full);
~PeerServer();
/// Connect to a peer explicitly.
void connect(std::string const& _addr, ushort _port = 30303) noexcept;
void connect(std::string const& _addr, unsigned short _port = 30303) noexcept;
void connect(bi::tcp::endpoint const& _ep);
/// Sync with the BlockChain. It might contain one of our mined blocks, we might have new candidates from the network.
@ -188,7 +188,7 @@ public:
void pingAll();
/// Get the port we're listening on currently.
ushort listenPort() const { return m_public.port(); }
unsigned short listenPort() const { return m_public.port(); }
bytes savePeers() const;
void restorePeers(bytesConstRef _b);
@ -209,7 +209,7 @@ private:
std::string m_clientVersion;
NodeMode m_mode = NodeMode::Full;
ushort m_listenPort;
unsigned short m_listenPort;
BlockChain const* m_chain = nullptr;
ba::io_service m_ioService;

Loading…
Cancel
Save