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)
评论列表
文章目录