mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12: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)
|
buf,bsz = buffer.push(buf, msg, sz)
|
||||||
end
|
end
|
||||||
READBUF[fd] = buf
|
READBUF[fd] = buf
|
||||||
if qsz == nil then
|
local session = READSESSION[fd]
|
||||||
|
if qsz == nil or session == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if type(qsz) == "number" then
|
if type(qsz) == "number" then
|
||||||
@@ -47,7 +48,8 @@ skynet.register_protocol {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
response(READSESSION[fd])
|
response(session)
|
||||||
|
READSESSION[fd] = nil
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ skynet.start(function()
|
|||||||
local db = redis.connect "main"
|
local db = redis.connect "main"
|
||||||
print(db:select(0))
|
print(db:select(0))
|
||||||
db:batch "write" -- ignore results
|
db:batch "write" -- ignore results
|
||||||
|
db:del "C"
|
||||||
db:set("A", "hello")
|
db:set("A", "hello")
|
||||||
db:set("B", "world")
|
db:set("B", "world")
|
||||||
db:sadd("C", "one")
|
db:sadd("C", "one")
|
||||||
@@ -17,6 +18,19 @@ skynet.start(function()
|
|||||||
for k,v in pairs(r) do
|
for k,v in pairs(r) do
|
||||||
print(k,v)
|
print(k,v)
|
||||||
end
|
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:exists "A")
|
||||||
print(db:get "A")
|
print(db:get "A")
|
||||||
print(db:set("A","hello world"))
|
print(db:set("A","hello world"))
|
||||||
|
|||||||
Reference in New Issue
Block a user