Error on full buffer

This commit is contained in:
flamingcow
2019-05-09 19:19:15 -07:00
parent 49766e29f4
commit 4d9486e281

View File

@@ -7,6 +7,10 @@ StreamBuffer::StreamBuffer(int sock, size_t size)
sock_(sock) {} sock_(sock) {}
bool StreamBuffer::Refill() { bool StreamBuffer::Refill() {
if (WriteMaxLen() == 0) {
LOG(ERROR) << "buffer full";
return false;
}
auto read_len = read(sock_, WritePtr(), WriteMaxLen()); auto read_len = read(sock_, WritePtr(), WriteMaxLen());
if (read_len == -1) { if (read_len == -1) {
if (errno == EINTR) { if (errno == EINTR) {