NetBase.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:MyPythonLib 作者: BillWang139967 项目源码 文件源码
def run(self):
        '''????
        ??epoll????????
        '''
        while True:
            #dbgPrint("\n -- run func loop")
            #for i in self.conn_state.iterkeys():
            #    dbgPrint("\n -- state of fd: %d" % i)
            #    self.conn_state[i].printState();

            # epoll??
            # ????????????????????????????????
            # ?????????epoll???????
            # epoll???IO
            epoll_list = self.epoll_sock.poll()
            for fd, events in epoll_list:
                dbgPrint("\n-- run epoll return fd: %d, event: %s" %(fd, events))
                sock_state = self.conn_state[fd]
                # ?? epoll??
                # ???io???epoll hang??????
                if select.EPOLLHUP & events:
                    dbgPrint("events EPOLLHUP")
                    sock_state.state = "closing"
                # ??IO??epoll?????????
                elif select.EPOLLERR & events:
                    dbgPrint("EPOLLERROR")
                    sock_state.state = "closing"

                self.state_machine(fd)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号