diff options
author | rch <rch@chromium.org> | 2015-03-29 23:49:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-30 06:49:46 +0000 |
commit | a39266fb72900b93bb99c1f66a3a6f4d092c0063 (patch) | |
tree | f163ec55d8f978ed8a373196b75d2318e07145ef /net/tools/flip_server | |
parent | 05631f95b98b2ca9a9af0d185aeff3a140de5c33 (diff) | |
download | chromium_src-a39266fb72900b93bb99c1f66a3a6f4d092c0063.zip chromium_src-a39266fb72900b93bb99c1f66a3a6f4d092c0063.tar.gz chromium_src-a39266fb72900b93bb99c1f66a3a6f4d092c0063.tar.bz2 |
Revert "make EpollServer with with Posix poll(), take 2."
This reverts commit 80b1342589acaa8630d221eb4a7fecf6191d88b9.
Original review https://codereview.chromium.org/987803002
Review URL: https://codereview.chromium.org/1042583002
Cr-Commit-Position: refs/heads/master@{#322743}
Diffstat (limited to 'net/tools/flip_server')
-rw-r--r-- | net/tools/flip_server/acceptor_thread.cc | 5 | ||||
-rw-r--r-- | net/tools/flip_server/sm_connection.cc | 31 |
2 files changed, 17 insertions, 19 deletions
diff --git a/net/tools/flip_server/acceptor_thread.cc b/net/tools/flip_server/acceptor_thread.cc index ceba935..2b65e5d 100644 --- a/net/tools/flip_server/acceptor_thread.cc +++ b/net/tools/flip_server/acceptor_thread.cc @@ -76,8 +76,7 @@ SMConnection* SMAcceptorThread::FindOrMakeNewSMConnection() { } void SMAcceptorThread::InitWorker() { - epoll_server_.RegisterFD(acceptor_->listen_fd_, this, - PollBits(NET_POLLIN | NET_POLLET)); + epoll_server_.RegisterFD(acceptor_->listen_fd_, this, EPOLLIN | EPOLLET); } void SMAcceptorThread::HandleConnection(int server_fd, @@ -198,7 +197,7 @@ void SMAcceptorThread::Run() { } void SMAcceptorThread::OnEvent(int fd, EpollEvent* event) { - if (event->in_events | NET_POLLIN) { + if (event->in_events | EPOLLIN) { VLOG(2) << ACCEPTOR_CLIENT_IDENT << "Acceptor: Accepting based upon epoll events"; AcceptFromListenFD(); diff --git a/net/tools/flip_server/sm_connection.cc b/net/tools/flip_server/sm_connection.cc index 435bb2e..4acdea4 100644 --- a/net/tools/flip_server/sm_connection.cc +++ b/net/tools/flip_server/sm_connection.cc @@ -65,8 +65,8 @@ EpollServer* SMConnection::epoll_server() { return epoll_server_; } void SMConnection::ReadyToSend() { VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT - << "Setting ready to send: POLLIN | POLLOUT"; - epoll_server_->SetFDReady(fd_, NET_POLLIN | NET_POLLOUT); + << "Setting ready to send: EPOLLIN | EPOLLOUT"; + epoll_server_->SetFDReady(fd_, EPOLLIN | EPOLLOUT); } void SMConnection::EnqueueDataFrame(DataFrame* df) { @@ -150,8 +150,7 @@ void SMConnection::InitSMConnection(SMConnectionPoolInterface* connection_pool, read_buffer_.Clear(); - epoll_server_->RegisterFD(fd_, this, - PollBits(NET_POLLIN | NET_POLLOUT | NET_POLLET)); + epoll_server_->RegisterFD(fd_, this, EPOLLIN | EPOLLOUT | EPOLLET); if (use_ssl) { ssl_ = CreateSSLContext(ssl_state_->ssl_ctx); @@ -257,14 +256,14 @@ void SMConnection::Cleanup(const char* cleanup) { void SMConnection::HandleEvents() { VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT - << "Received: " << PollBits(events_).ToString(); + << "Received: " << EpollServer::EventMaskToString(events_).c_str(); - if (events_ & NET_POLLIN) { + if (events_ & EPOLLIN) { if (!DoRead()) goto handle_close_or_error; } - if (events_ & NET_POLLOUT) { + if (events_ & EPOLLOUT) { // Check if we have connected or not if (connection_complete_ == false) { int sock_error; @@ -293,7 +292,7 @@ void SMConnection::HandleEvents() { goto handle_close_or_error; } - if (events_ & (NET_POLLHUP | NET_POLLERR)) { + if (events_ & (EPOLLHUP | EPOLLERR)) { VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT << "!!! Got HUP or ERR"; goto handle_close_or_error; } @@ -430,7 +429,7 @@ bool SMConnection::DoRead() { case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_ACCEPT: case SSL_ERROR_WANT_CONNECT: - events_ &= ~NET_POLLIN; + events_ &= ~EPOLLIN; VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT << "DoRead: SSL WANT_XXX: " << err; goto done; @@ -446,7 +445,7 @@ bool SMConnection::DoRead() { if (bytes_read == -1) { switch (stored_errno) { case EAGAIN: - events_ &= ~NET_POLLIN; + events_ &= ~EPOLLIN; VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT << "Got EAGAIN while reading"; goto done; @@ -510,13 +509,13 @@ bool SMConnection::DoConsumeReadData() { VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT << "HandleRequestFullyRead: Setting EPOLLOUT"; HandleResponseFullyRead(); - events_ |= NET_POLLOUT; + events_ |= EPOLLOUT; } else if (sm_interface_->Error()) { LOG(ERROR) << log_prefix_ << ACCEPTOR_CLIENT_IDENT << "Framer error detected: Setting EPOLLOUT: " << sm_interface_->ErrorAsString(); // this causes everything to be closed/cleaned up. - events_ |= NET_POLLOUT; + events_ |= EPOLLOUT; return false; } read_buffer_.GetReadablePtr(&bytes, &size); @@ -540,7 +539,7 @@ bool SMConnection::DoWrite() { sm_interface_->GetOutput(); } if (output_list_.empty()) { - events_ &= ~NET_POLLOUT; + events_ &= ~EPOLLOUT; } } while (!output_list_.empty()) { @@ -550,7 +549,7 @@ bool SMConnection::DoWrite() { VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT << " byte sent >= max bytes sent per write: Setting EPOLLOUT: " << bytes_sent; - events_ |= NET_POLLOUT; + events_ |= EPOLLOUT; break; } if (sm_interface_ && output_list_.size() < 2) { @@ -582,7 +581,7 @@ bool SMConnection::DoWrite() { if (bytes_written == -1) { switch (stored_errno) { case EAGAIN: - events_ &= ~NET_POLLOUT; + events_ &= ~EPOLLOUT; VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT << "Got EAGAIN while writing"; goto done; @@ -604,7 +603,7 @@ bool SMConnection::DoWrite() { continue; } else if (bytes_written == -2) { // -2 handles SSL_ERROR_WANT_* errors - events_ &= ~NET_POLLOUT; + events_ &= ~EPOLLOUT; goto done; } VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT |