陈硕你好,我对TcpServer中ConnectionMap的设计不太明白。
查看全部代码,ConnectionMap仅在TcpServer析构的时候使用。
我尝试ConnectionMap放入到各自连接的ioLoop中。handleClose的时候直接当前loop调用connectDestroyed。
TcpServer析构时,所有连接的释放也下推到EventLoop的析构中处理。
talk is cheap,here is the code. 为实现上述所新建的一个branch
https://github.com/zhangyu0310/muduo/tree/connInLoop