处理函数是:readQueryFromClient
- nread = read(fd, buf, REDIS_QUERYBUF_LEN);
- if (nread == -1)
- {
- if (errno == EAGAIN)
- {
- nread = 0;
- }
- else
- {
- redisLog(REDIS_DEBUG, "Reading from client: %s",strerror(errno));
- freeClient(c);
- return;
- }
- }
- else if (nread == 0)
- {
- redisLog(REDIS_DEBUG, "Client closed connection");
- freeClient(c);
- return;
- }
- if (nread)
- {
- c->querybuf = sdscatlen(c->querybuf, buf, nread);
- c->lastinteraction = time(NULL);
- }
- else
- {
- return;
- }