add trace into simpledb

This commit is contained in:
云风
2012-09-15 16:05:25 +08:00
parent 0f7ac5dc0a
commit c19846c3a5
3 changed files with 27 additions and 18 deletions

View File

@@ -13,8 +13,16 @@ function command.SET(key, value)
skynet.ret(last)
end
local trace_cache = {}
skynet.trace_callback(function(handle, ti)
print("TRACE",trace_cache[handle],ti)
trace_cache[handle] = nil
end)
skynet.start(function()
skynet.dispatch("text", function(session, address, message)
trace_cache[skynet.trace()] = message
print("simpledb",message, skynet.address(address), session)
local cmd, key , value = string.match(message, "(%w+) (%w+) ?(.*)")
local f = command[cmd]