mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
cond break point
This commit is contained in:
@@ -134,7 +134,7 @@ local function add_watch_hook()
|
|||||||
end, "r")
|
end, "r")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function watch_proto(protoname)
|
local function watch_proto(protoname, cond)
|
||||||
local proto = assert(replace_upvalue(skynet.register_protocol, "proto"), "Can't find proto table")
|
local proto = assert(replace_upvalue(skynet.register_protocol, "proto"), "Can't find proto table")
|
||||||
local p = proto[protoname]
|
local p = proto[protoname]
|
||||||
local dispatch = p.dispatch_origin or p.dispatch
|
local dispatch = p.dispatch_origin or p.dispatch
|
||||||
@@ -143,8 +143,10 @@ local function watch_proto(protoname)
|
|||||||
end
|
end
|
||||||
p.dispatch_origin = dispatch
|
p.dispatch_origin = dispatch
|
||||||
p.dispatch = function(...)
|
p.dispatch = function(...)
|
||||||
p.dispatch = dispatch -- restore origin dispatch function
|
if not cond or cond(...) then
|
||||||
add_watch_hook()
|
p.dispatch = dispatch -- restore origin dispatch function
|
||||||
|
add_watch_hook()
|
||||||
|
end
|
||||||
dispatch(...)
|
dispatch(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -202,7 +204,6 @@ local function hook_dispatch(dispatcher, resp, fd, channel)
|
|||||||
local function debug_hook()
|
local function debug_hook()
|
||||||
while true do
|
while true do
|
||||||
if newline then
|
if newline then
|
||||||
socket.write(fd, "\n")
|
|
||||||
socket.write(fd, prompt)
|
socket.write(fd, prompt)
|
||||||
newline = false
|
newline = false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user