赞
踩
aeCreateFileEvent(server.el,server.ipfd,AE_READABLE,acceptTcpHandler,NULL);
acceptTcpHandler每accept到一个clientfd,会为该fd调用createClient(有maxclients限制可配);
redisClient *createClient(int fd)
1、nonblock&tcpnodelay设置;
2、aeCreateFileEvent(server.el,fd,AE_READABLE,readQueryFromClient, c)将fd交给网络模型托管,当readable时,调用readQueryFromClient处理;
3、初始化;
4、将c加入server.clients链表;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。