From b37ed665b3df5153e791aeed351b5c3793d91e74 Mon Sep 17 00:00:00 2001 From: Jon Daniel Date: Tue, 13 Sep 2005 18:26:23 +0000 Subject: [PATCH] Fix BeOS send_buf() --- src/network_worker.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/network_worker.cpp b/src/network_worker.cpp index 400e72cdc45..6c64588a6e5 100644 --- a/src/network_worker.cpp +++ b/src/network_worker.cpp @@ -105,14 +105,20 @@ threading::condition* cond = NULL; std::vector threads; SOCKET_STATE send_buf(TCPsocket sock, std::vector& buf) { +#ifdef __BEOS__ + int timeout = 15000; +#endif size_t upto = 0; size_t size = buf.size(); { const threading::lock lock(*global_mutex); transfer_stats[sock].first.fresh_current(size); } - +#ifdef __BEOS__ + while(upto < size && timeout > 0) { +#else while(upto < size) { +#endif { // check if the socket is still locked const threading::lock lock(*global_mutex); @@ -140,7 +146,7 @@ SOCKET_STATE send_buf(TCPsocket sock, std::vector& buf) { if(poll_res > 0) continue; } -#elif defined(USE_SELECT) +#elif defined(USE_SELECT) && !defined(__BEOS__) fd_set writefds; FD_ZERO(&writefds); FD_SET(((_TCPsocket*)sock)->channel, &writefds); @@ -157,10 +163,16 @@ SOCKET_STATE send_buf(TCPsocket sock, std::vector& buf) { continue; } #else + SDL_Delay(10); + timeout -= 10; + continue; } #endif return SOCKET_ERROR; } +#ifdef __BEOS__ + timeout = 15000; +#endif upto += static_cast(res); { const threading::lock lock(*global_mutex);