mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
add skynet.watch for skynet.call, read http://blog.codingnow.com/2013/12/skynet_monitor.html
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
#define PTYPE_SYSTEM 4
|
||||
#define PTYPE_HARBOR 5
|
||||
#define PTYPE_SOCKET 6
|
||||
// don't use these id
|
||||
#define PTYPE_RESERVED_0 7
|
||||
// read lualib/skynet.lua lualib/simplemonitor.lua
|
||||
#define PTYPE_EXIT 7
|
||||
// read lualib/skynet.lua lualib/mqueue.lua
|
||||
#define PTYPE_RESERVED_QUEUE 8
|
||||
#define PTYPE_RESERVED_DEBUG 9
|
||||
|
||||
@@ -540,7 +540,12 @@ skynet_command(struct skynet_context * context, const char * cmd , const char *
|
||||
if (strcmp(cmd,"MONITOR") == 0) {
|
||||
uint32_t handle=0;
|
||||
if (param == NULL || param[0] == '\0') {
|
||||
handle = context->handle;
|
||||
if (G_NODE.monitor_exit) {
|
||||
// return current monitor serivce
|
||||
sprintf(context->result, ":%x", G_NODE.monitor_exit);
|
||||
return context->result;
|
||||
}
|
||||
return NULL;
|
||||
} else {
|
||||
if (param[0] == ':') {
|
||||
handle = strtoul(param+1, NULL, 16);
|
||||
|
||||
Reference in New Issue
Block a user