From 00efa6cc8a54593f5122a255e8cee9ef9c9a658c Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Wed, 11 Feb 2015 14:46:46 +0800 Subject: [PATCH] cond break point --- lualib/skynet/remotedebug.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lualib/skynet/remotedebug.lua b/lualib/skynet/remotedebug.lua index 0bef884c..338cbff8 100644 --- a/lualib/skynet/remotedebug.lua +++ b/lualib/skynet/remotedebug.lua @@ -134,7 +134,7 @@ local function add_watch_hook() end, "r") 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 p = proto[protoname] local dispatch = p.dispatch_origin or p.dispatch @@ -143,8 +143,10 @@ local function watch_proto(protoname) end p.dispatch_origin = dispatch p.dispatch = function(...) - p.dispatch = dispatch -- restore origin dispatch function - add_watch_hook() + if not cond or cond(...) then + p.dispatch = dispatch -- restore origin dispatch function + add_watch_hook() + end dispatch(...) end end @@ -202,7 +204,6 @@ local function hook_dispatch(dispatcher, resp, fd, channel) local function debug_hook() while true do if newline then - socket.write(fd, "\n") socket.write(fd, prompt) newline = false end