Commit 31940cf1 authored by knowledge4igor's avatar knowledge4igor

Tiny code structure improvement

parent 3beb79cc
...@@ -219,25 +219,22 @@ Listener::run() { ...@@ -219,25 +219,22 @@ Listener::run() {
if (errno == EINTR && g_listen_fd == -1) return; if (errno == EINTR && g_listen_fd == -1) return;
throw Error::system("Polling"); throw Error::system("Polling");
} }
else if (ready_fds > 0) { for (const auto& event: events) {
for (const auto& event: events) { if (event.tag == shutdownFd.tag())
if (event.tag == shutdownFd.tag()) return;
return;
else { if (event.flags.hasFlag(Polling::NotifyOn::Read)) {
if (event.flags.hasFlag(Polling::NotifyOn::Read)) { auto fd = event.tag.value();
auto fd = event.tag.value(); if (static_cast<ssize_t>(fd) == listen_fd) {
if (static_cast<ssize_t>(fd) == listen_fd) { try {
try { handleNewConnection();
handleNewConnection(); }
} catch (SocketError& ex) {
catch (SocketError& ex) { std::cerr << "Server: " << ex.what() << std::endl;
std::cerr << "Server: " << ex.what() << std::endl; }
} catch (ServerError& ex) {
catch (ServerError& ex) { std::cerr << "Server: " << ex.what() << std::endl;
std::cerr << "Server: " << ex.what() << std::endl; throw;
throw;
}
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment