mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
http: Treat buffer full flush correctly.
Unix platforms may fail send with EAGAIN instead of 0 bytes.
This commit is contained in:
parent
fd1807b4b9
commit
c7becb2c75
1 changed files with 8 additions and 0 deletions
|
@ -343,6 +343,10 @@ bool OutputSink::Flush(bool allowBlock) {
|
||||||
size_t avail = std::min(BUFFER_SIZE - read_, valid_);
|
size_t avail = std::min(BUFFER_SIZE - read_, valid_);
|
||||||
|
|
||||||
int bytes = send(fd_, buf_ + read_, (int)avail, MSG_NOSIGNAL);
|
int bytes = send(fd_, buf_ + read_, (int)avail, MSG_NOSIGNAL);
|
||||||
|
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||||
|
if (bytes == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
|
||||||
|
bytes = 0;
|
||||||
|
#endif
|
||||||
AccountDrain(bytes);
|
AccountDrain(bytes);
|
||||||
|
|
||||||
if (bytes == 0) {
|
if (bytes == 0) {
|
||||||
|
@ -371,6 +375,10 @@ void OutputSink::Drain() {
|
||||||
size_t avail = std::min(BUFFER_SIZE - read_, valid_);
|
size_t avail = std::min(BUFFER_SIZE - read_, valid_);
|
||||||
|
|
||||||
int bytes = send(fd_, buf_ + read_, (int)avail, MSG_NOSIGNAL);
|
int bytes = send(fd_, buf_ + read_, (int)avail, MSG_NOSIGNAL);
|
||||||
|
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||||
|
if (bytes == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
|
||||||
|
bytes = 0;
|
||||||
|
#endif
|
||||||
AccountDrain(bytes);
|
AccountDrain(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue