We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
void Server::handNewConn() { while((accept_fd = accept(listenFd_, (struct sockaddr*)&client_addr, &client_addr_len)) > 0) { EventLoop *loop = eventLoopThreadPool_->getNextLoop(); ... } acceptChannel_->setEvents(EPOLLIN | EPOLLET); }
2.EventLoop::runInLoop(Functor&& cb),每一个thread都有负责一个loop,loop在某一个thread里面一直循环。程序走到这里,一定是某个thread监听的fd有事件,那么这个if判断是否一定为真?
void EventLoop::runInLoop(Functor&& cb) { if (isInLoopThread()) cb(); else queueInLoop(std::move(cb)); }
3.void HttpData::handleRead(),这个函数里面有这样一段代码,error判断了多次,注释里解释是error可能会变。我是这样想的:每个对于每一个accept_fd,都有一个channel,都有一个独立的httpdata实例,那error会什么会变呢?
if (!error_) { if (outBuffer_.size() > 0) { handleWrite(); } // error_ may change if (!error_ && state_ == STATE_FINISH) { this->reset(); if (inBuffer_.size() > 0) { if (connectionState_ != H_DISCONNECTING) handleRead(); } } else if (!error_ && connectionState_ != H_DISCONNECTED) events_ |= EPOLLIN; }
The text was updated successfully, but these errors were encountered:
@tiankaijin
Sorry, something went wrong.
No branches or pull requests
2.EventLoop::runInLoop(Functor&& cb),每一个thread都有负责一个loop,loop在某一个thread里面一直循环。程序走到这里,一定是某个thread监听的fd有事件,那么这个if判断是否一定为真?
3.void HttpData::handleRead(),这个函数里面有这样一段代码,error判断了多次,注释里解释是error可能会变。我是这样想的:每个对于每一个accept_fd,都有一个channel,都有一个独立的httpdata实例,那error会什么会变呢?
The text was updated successfully, but these errors were encountered: