Simplify process_connection_writes condition
And comment explaining that we there's something more precise but more complex available.
This commit is contained in:
@@ -248,7 +248,7 @@ struct Connection {
|
||||
}
|
||||
|
||||
// Match server's connection state management
|
||||
bool hasMessages() const { return !request.empty(); }
|
||||
bool has_messages() const { return !request.empty(); }
|
||||
bool error = false;
|
||||
|
||||
~Connection() {
|
||||
@@ -698,7 +698,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Transfer back to epoll instance. This thread or another thread
|
||||
// will wake when fd is ready
|
||||
if (conn->hasMessages()) {
|
||||
if (conn->has_messages()) {
|
||||
events[i].events = EPOLLOUT | EPOLLONESHOT;
|
||||
} else {
|
||||
events[i].events = EPOLLIN | EPOLLONESHOT;
|
||||
@@ -748,7 +748,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Try to write once in the connect thread before handing off to network
|
||||
// threads
|
||||
assert(conn->hasMessages());
|
||||
assert(conn->has_messages());
|
||||
bool writeFinished = conn->writeBytes();
|
||||
if (conn->error) {
|
||||
continue; // Connection failed, destructor will clean up
|
||||
@@ -766,7 +766,7 @@ int main(int argc, char *argv[]) {
|
||||
event.events = EPOLLIN | EPOLLONESHOT;
|
||||
} else {
|
||||
event.events =
|
||||
(conn->hasMessages() ? EPOLLOUT : EPOLLIN) | EPOLLONESHOT;
|
||||
(conn->has_messages() ? EPOLLOUT : EPOLLIN) | EPOLLONESHOT;
|
||||
}
|
||||
|
||||
// Add to a round-robin selected epoll instance to distribute load
|
||||
|
||||
Reference in New Issue
Block a user