mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-30 19:24:23 +01:00
InputSink: Inline AccountFill into Fill
This commit is contained in:
1 parent
2c4e3e241c
commit
82a3ef31b1
2 files changed
+14
-19
No files matched your search
+14
-18
@@ -191,7 +191,20 @@ void InputSink::Fill() {
|
||||
size_t avail = BUFFER_SIZE - std::max(write_, valid_);
|
||||
|
||||
int bytes = recv(fd_, buf_ + write_, avail, MSG_NOSIGNAL);
|
||||
AccountFill(bytes);
|
||||
if (bytes < 0) {
|
||||
int err = socket_errno;
|
||||
if (err == EWOULDBLOCK || err == EAGAIN)
|
||||
return;
|
||||
ERROR_LOG(Log::Net, "Error reading from socket: %d", err);
|
||||
return;
|
||||
}
|
||||
|
||||
// Okay, move forward (might be by zero.)
|
||||
valid_ += bytes;
|
||||
write_ += bytes;
|
||||
if (write_ >= BUFFER_SIZE) {
|
||||
write_ -= BUFFER_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,23 +217,6 @@ bool InputSink::Block() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void InputSink::AccountFill(int bytes) {
|
||||
if (bytes < 0) {
|
||||
int err = socket_errno;
|
||||
if (err == EWOULDBLOCK || err == EAGAIN)
|
||||
return;
|
||||
ERROR_LOG(Log::Net, "Error reading from socket: %d", err);
|
||||
return;
|
||||
}
|
||||
|
||||
// Okay, move forward (might be by zero.)
|
||||
valid_ += bytes;
|
||||
write_ += bytes;
|
||||
if (write_ >= BUFFER_SIZE) {
|
||||
write_ -= BUFFER_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
void InputSink::AccountDrain(size_t bytes) {
|
||||
valid_ -= bytes;
|
||||
read_ += bytes;
|
||||
|
||||
Reference in new issue
Block a user