fix build now that libtorrent::sleep is gone
This commit is contained in:
parent
794de25212
commit
58aa4e5ae7
|
@ -76,6 +76,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
using boost::bind;
|
||||
using libtorrent::total_milliseconds;
|
||||
|
||||
void sleep_ms(int milliseconds)
|
||||
{
|
||||
#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN
|
||||
Sleep(milliseconds);
|
||||
#elif defined TORRENT_BEOS
|
||||
snooze_until(system_time() + boost::int64_t(milliseconds) * 1000, B_SYSTEM_TIMEBASE);
|
||||
#else
|
||||
usleep(milliseconds * 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -150,7 +161,7 @@ retry:
|
|||
if (ret < 0 && errno != 0 && errno != ETIMEDOUT)
|
||||
{
|
||||
fprintf(stderr, "select failed: %s\n", strerror(errno));
|
||||
libtorrent::sleep(500);
|
||||
sleep_ms(500);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -102,6 +102,17 @@ boost::detail::atomic_count num_suggest(0);
|
|||
// the number of requests made from suggested pieces
|
||||
boost::detail::atomic_count num_suggested_requests(0);
|
||||
|
||||
void sleep_ms(int milliseconds)
|
||||
{
|
||||
#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN
|
||||
Sleep(milliseconds);
|
||||
#elif defined TORRENT_BEOS
|
||||
snooze_until(system_time() + boost::int64_t(milliseconds) * 1000, B_SYSTEM_TIMEBASE);
|
||||
#else
|
||||
usleep(milliseconds * 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string leaf_path(std::string f)
|
||||
{
|
||||
if (f.empty()) return "";
|
||||
|
@ -1044,7 +1055,7 @@ int main(int argc, char* argv[])
|
|||
else if (test_mode == dual_test) seed = (i & 1);
|
||||
conns.push_back(new peer_conn(ios[i % num_threads], ti.num_pieces(), ti.piece_length() / 16 / 1024
|
||||
, ep, (char const*)&ti.info_hash()[0], seed, churn, corrupt));
|
||||
libtorrent::sleep(1);
|
||||
sleep_ms(1);
|
||||
ios[i % num_threads].poll_one(ec);
|
||||
if (ec)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue