当前位置:   article > 正文

Redis源码系列29:客户与服务器之间的网络交互源码readQueryFromClient

Redis源码系列29:客户与服务器之间的网络交互源码readQueryFromClient

处理函数是:readQueryFromClient

  1. nread = read(fd, buf, REDIS_QUERYBUF_LEN);
  2. if (nread == -1)
  3. {
  4. if (errno == EAGAIN)
  5. {
  6. nread = 0;
  7. }
  8. else
  9. {
  10. redisLog(REDIS_DEBUG, "Reading from client: %s",strerror(errno));
  11. freeClient(c);
  12. return;
  13. }
  14. }
  15. else if (nread == 0)
  16. {
  17. redisLog(REDIS_DEBUG, "Client closed connection");
  18. freeClient(c);
  19. return;
  20. }
  21. if (nread)
  22. {
  23. c->querybuf = sdscatlen(c->querybuf, buf, nread);
  24. c->lastinteraction = time(NULL);
  25. }
  26. else
  27. {
  28. return;
  29. }

 

转载于:https://my.oschina.net/qiangzigege/blog/205831

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/978432
推荐阅读
相关标签
  

闽ICP备14008679号