mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
bugfix: socket read
This commit is contained in:
@@ -33,7 +33,8 @@ skynet.register_protocol {
|
||||
buf,bsz = buffer.push(buf, msg, sz)
|
||||
end
|
||||
READBUF[fd] = buf
|
||||
if qsz == nil then
|
||||
local session = READSESSION[fd]
|
||||
if qsz == nil or session == nil then
|
||||
return
|
||||
end
|
||||
if type(qsz) == "number" then
|
||||
@@ -47,7 +48,8 @@ skynet.register_protocol {
|
||||
end
|
||||
end
|
||||
|
||||
response(READSESSION[fd])
|
||||
response(session)
|
||||
READSESSION[fd] = nil
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ skynet.start(function()
|
||||
local db = redis.connect "main"
|
||||
print(db:select(0))
|
||||
db:batch "write" -- ignore results
|
||||
db:del "C"
|
||||
db:set("A", "hello")
|
||||
db:set("B", "world")
|
||||
db:sadd("C", "one")
|
||||
@@ -17,6 +18,19 @@ skynet.start(function()
|
||||
for k,v in pairs(r) do
|
||||
print(k,v)
|
||||
end
|
||||
|
||||
db:batch "write"
|
||||
db:del "D"
|
||||
for i=1,1000 do
|
||||
db:hset("D",i,i)
|
||||
end
|
||||
db:batch "end"
|
||||
local r = db:hvals "D"
|
||||
for k,v in pairs(r) do
|
||||
print(k,v)
|
||||
end
|
||||
|
||||
|
||||
print(db:exists "A")
|
||||
print(db:get "A")
|
||||
print(db:set("A","hello world"))
|
||||
|
||||
Reference in New Issue
Block a user