redisプロトコルの簡単な紹介

1486 ワード

zhoulin@:/opt/redis307/src:gdb ./redis-server  --  redis    
(gdb) set args /etc/redis_6379.conf  --  gdb  
(gdb) br readQueryFromClient --
1180 nread = read(fd, c->querybuf+qblen, readlen); -- fd
(gdb) p c->querybuf
$5 = (sds) 0x7ffff1515008 "*3\r
$3\r
set\r
$8\r
user1:id\r
$3\r
100\r
"
  redis \r
, :
    *3\r
-- 3 :set user1:id 100 , 3
    $3\r
set\r
set 3
    $8\r
user1:id\r
---user1:id 8
    $3\r
100\r
" --100 3
   reids 1 1 2 2 3 3
 

(gdb) thread apply all b

  Thread 1 (Thread 0x7ffff7fef720 (LWP 39512)):  #0 readQueryFromClient (el=0x7ffff14a9150, fd=10, privdata=0x7ffff1510000, mask=1) at networking.c:1181  #1 0x000000000041b799 in aeProcessEvents (eventLoop=0x7ffff14a9150, flags=3) at ae.c:412  #2 0x000000000041b92e in aeMain (eventLoop=0x7ffff14a9150) at ae.c:455  #3 0x00000000004275e9 in main (argc=2, argv=0x7fffffffe548) at redis.c:3706
bt                :
man->aeMain->aeProcessEvents