diff --git a/eth/main.cpp b/eth/main.cpp index 04e4871b3..993451378 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -236,7 +236,7 @@ int main(int argc, char** argv) c.stopMining(); else c.startMining(); - usleep(100000); + std::this_thread::sleep_for(std::chrono::microseconds(100000)); } } diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index ea9c6b3bc..df3cc7e18 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -64,7 +64,7 @@ Client::~Client() if (m_workState == Active) m_workState = Deleting; while (m_workState != Deleted) - usleep(10000); + std::this_thread::sleep_for(std::chrono::microseconds(10000)); } void Client::startNetwork(short _listenPort, std::string const& _seedHost, short _port, NodeMode _mode, unsigned _peers, string const& _publicIP, bool _upnp) @@ -158,7 +158,7 @@ void Client::work() } } else - usleep(100000); + std::this_thread::sleep_for(std::chrono::microseconds(100000)); } void Client::lock() diff --git a/libethereum/PeerNetwork.cpp b/libethereum/PeerNetwork.cpp index ecc2e6f72..089cc29cb 100644 --- a/libethereum/PeerNetwork.cpp +++ b/libethereum/PeerNetwork.cpp @@ -919,7 +919,7 @@ bool PeerServer::process(BlockChain& _bc, TransactionQueue& _tq, Overlay& _o) std::vector PeerServer::peers() const { const_cast(this)->pingAll(); - usleep(200000); + std::this_thread::sleep_for(std::chrono::microseconds(200000)); std::vector ret; for (auto& i: m_peers) if (auto j = i.lock()) diff --git a/libethereum/UPnP.cpp b/libethereum/UPnP.cpp index 5b92d5373..c70177421 100644 --- a/libethereum/UPnP.cpp +++ b/libethereum/UPnP.cpp @@ -117,7 +117,7 @@ int UPnP::addRedirect(char const* addr, int port) // Failed - now try (random external, port internal) and cycle up to 10 times. for (uint i = 0; i < 10; ++i) { - port = random() % 65535 - 1024 + 1024; + port = rand() % 65535 - 1024 + 1024; sprintf(port_str, "%d", port); if (!UPNP_AddPortMapping(m_urls->controlURL, m_data->first.servicetype, NULL, port_str, addr, "ethereum", "TCP", NULL, NULL)) return port; diff --git a/test/peer.cpp b/test/peer.cpp index 5a440a88f..6a5fb610a 100644 --- a/test/peer.cpp +++ b/test/peer.cpp @@ -53,7 +53,7 @@ int peerTest(int argc, char** argv) for (int i = 0; ; ++i) { - usleep(100000); + std::this_thread::sleep_for(std::chrono::microseconds(100000)); pn.process(ch); if (!(i % 10)) pn.pingAll();