GithubHelp home page GithubHelp logo

myicefrog / learn-tars Goto Github PK

View Code? Open in Web Editor NEW
108.0 5.0 46.0 3.69 MB

腾讯开源框架Tars源码学习笔记---从头搭建Tars rpc

C++ 94.85% Shell 0.74% Assembly 2.33% Makefile 2.09%
tars-rpc cpp tarscpp tarsframwork note

learn-tars's Issues

菜鸡有个问题没看懂...

2019-06-26 23-12-05屏幕截图
在你的第一个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的呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.