event/SocketMonitor: OnSocketReady() returns bool

This commit is contained in:
Max Kellermann
2013-01-30 10:53:32 +01:00
parent 73f36858bb
commit 4ad7456428
6 changed files with 18 additions and 10 deletions

View File

@@ -202,21 +202,21 @@ BufferedSocket::ConsumeInput(size_t nbytes)
fifo_buffer_consume(input, nbytes);
}
void
bool
BufferedSocket::OnSocketReady(unsigned flags)
{
assert(IsDefined());
if (gcc_unlikely(flags & (ERROR|HANGUP))) {
OnSocketClosed();
return;
return false;
}
if (flags & READ) {
assert(input == nullptr || !fifo_buffer_is_full(input));
if (!ReadToBuffer() || !ResumeInput())
return;
return false;
if (input == nullptr || !fifo_buffer_is_full(input))
ScheduleRead();
@@ -233,6 +233,8 @@ BufferedSocket::OnSocketReady(unsigned flags)
assert(!output.IsEmpty());
if (!WriteFromBuffer())
return;
return false;
}
return true;
}