myicefrog / learn-tars Goto Github PK
View Code? Open in Web Editor NEW腾讯开源框架Tars源码学习笔记---从头搭建Tars rpc
腾讯开源框架Tars源码学习笔记---从头搭建Tars rpc
在你的第一个commit的代码中,为何直接运行/tar-demo 时候,这时候没有客户端连接,epool_wait会被触发有两个事件,先close后noify,我看到代码中这里对应着两个不同的套接字,
epoller.add(_shutdown_sock, H64(ET_CLOSE), EPOLLIN);
epoller.add(_notify_sock, H64(ET_NOTIFY), EPOLLIN);
epoller.add(_sock, H64(ET_LISTEN) | _sock, EPOLLIN);
可是除了第二个参数不同外,就没有什么不同了这里会产生什么影响码.. 还有这里为什么要用H(64)这个宏定义进行左移32位操作额,
同步调用的时候,最后一步是:
void CommunicatorEpoll::notify(size_t iSeq,ReqInfoQueue * msgQueue)
{
if(_notify[iSeq].bValid)
{
_ep.mod(_notify[iSeq].notify.getfd(),(long long)&_notify[iSeq].stFDInfo, EPOLLIN);
assert(_notify[iSeq].stFDInfo.p == (void*)msgQueue);
}
else
{
_notify[iSeq].stFDInfo.iType = FDInfo::ET_C_NOTIFY;
_notify[iSeq].stFDInfo.p = (void*)msgQueue;
_notify[iSeq].stFDInfo.fd = _notify[iSeq].eventFd;
_notify[iSeq].stFDInfo.iSeq = iSeq;
_notify[iSeq].notify.createSocket();
_notify[iSeq].bValid = true;
_ep.add(_notify[iSeq].notify.getfd(),(long long)&_notify[iSeq].stFDInfo, EPOLLIN);
}
}
这一步是吧fd加到了epoll的监听中,epoll监听收到了NOTIFY类型的消息,就会发送该消息,那是怎么触发epoll的呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.