This commit is contained in:
flamingcow
2019-05-04 23:21:11 -07:00
commit dd9a0a974f
6 changed files with 188 additions and 0 deletions

18
stream_buffer.cc Normal file
View File

@@ -0,0 +1,18 @@
#include "stream_buffer.h"
namespace firebuf {
StreamBuffer::StreamBuffer(int sock, size_t size)
: Buffer(size),
sock_(sock) {}
bool StreamBuffer::Refill() {
auto read_len = read(sock_, WritePtr(), WriteMaxLen());
if (read_len == 0) {
return false;
}
Wrote(read_len);
return true;
}
} // namespace firebuf