mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
skynet.localname return nil when the name not exist
This commit is contained in:
@@ -229,7 +229,10 @@ function skynet.self()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function skynet.localname(name)
|
function skynet.localname(name)
|
||||||
return string_to_handle(c.command("QUERY", name))
|
local addr = c.command("QUERY", name)
|
||||||
|
if addr then
|
||||||
|
return string_to_handle(addr)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function skynet.launch(...)
|
function skynet.launch(...)
|
||||||
|
|||||||
@@ -368,8 +368,10 @@ static const char *
|
|||||||
cmd_query(struct skynet_context * context, const char * param) {
|
cmd_query(struct skynet_context * context, const char * param) {
|
||||||
if (param[0] == '.') {
|
if (param[0] == '.') {
|
||||||
uint32_t handle = skynet_handle_findname(param+1);
|
uint32_t handle = skynet_handle_findname(param+1);
|
||||||
sprintf(context->result, ":%x", handle);
|
if (handle) {
|
||||||
return context->result;
|
sprintf(context->result, ":%x", handle);
|
||||||
|
return context->result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user