Skip to content
New issue

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

tcp连接接收数据问题 #168

Open
ivanzz1001 opened this issue Jul 29, 2019 · 0 comments
Open

tcp连接接收数据问题 #168

ivanzz1001 opened this issue Jul 29, 2019 · 0 comments

Comments

@ivanzz1001
Copy link

看到tcp接收数据的模块。首先新的TCP连接进来,TcpAccepter会接受该连接,然后调用TcpAcceptor :: AddEvent()函数将其加入到一个负载最低的EventLoop中,在EventLoop :: AddEvent()将该文件句柄加入到m_oFDQueue之后,是否需要调用EventLoop :: JumpoutEpollWait()函数以通知EventLoop尽快将队列中的fd加入到epoll中,否则需要等到下一次超时后才能处理。

因此将EventLoop::AddEvent()改为如下是否较为合适:
void EventLoop :: AddEvent(int iFD, SocketAddress oAddr)
{
std::lock_guardstd::mutex oLockGuard(m_oMutex);
m_oFDQueue.push(make_pair(iFD, oAddr));

//新添加行
JumpoutEpollWait();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant