(cherry picked from commit 4506d20136
)
This commit is contained in:
parent
0f4a7a2a53
commit
04244310da
|
@ -27,17 +27,6 @@
|
|||
#include "tr-utp.h"
|
||||
#include "utils.h" // for _()
|
||||
|
||||
#ifdef _WIN32
|
||||
#undef EAGAIN
|
||||
#define EAGAIN WSAEWOULDBLOCK
|
||||
#undef EINTR
|
||||
#define EINTR WSAEINTR
|
||||
#undef EINPROGRESS
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#undef EPIPE
|
||||
#define EPIPE WSAECONNRESET
|
||||
#endif
|
||||
|
||||
#define tr_logAddErrorIo(io, msg) tr_logAddError(msg, (io)->display_name())
|
||||
#define tr_logAddWarnIo(io, msg) tr_logAddWarn(msg, (io)->display_name())
|
||||
#define tr_logAddDebugIo(io, msg) tr_logAddDebug(msg, (io)->display_name())
|
||||
|
@ -49,7 +38,12 @@ namespace
|
|||
// since that's what peer-io does by default anyway.
|
||||
[[nodiscard]] auto constexpr canRetryFromError(int error_code) noexcept
|
||||
{
|
||||
return error_code == 0 || error_code == EAGAIN || error_code == EINTR || error_code == EINPROGRESS;
|
||||
#ifdef _WIN32
|
||||
return error_code == 0 || error_code == WSAEWOULDBLOCK || error_code == WSAEINTR || error_code == WSAEINPROGRESS;
|
||||
#else
|
||||
return error_code == 0 || error_code == EAGAIN || error_code == EWOULDBLOCK || error_code == EINTR ||
|
||||
error_code == EINPROGRESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t get_desired_output_buffer_size(tr_peerIo const* io, uint64_t now)
|
||||
|
@ -412,7 +406,7 @@ size_t tr_peerIo::try_read(size_t max)
|
|||
|
||||
// Do not write more than the bandwidth allows.
|
||||
// If there is no bandwidth left available, disable writes.
|
||||
max = bandwidth().clamp(TR_DOWN, max);
|
||||
max = bandwidth().clamp(Dir, max);
|
||||
if (max == 0)
|
||||
{
|
||||
set_enabled(Dir, false);
|
||||
|
|
Loading…
Reference in New Issue