diff --git a/lualib/skynet.lua b/lualib/skynet.lua index 3f260b3e..522a0a9a 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -309,7 +309,10 @@ function skynet.call(addr, typename, ...) if watching_service[addr] == false then error("Service is dead") end - local session = assert(c.send(addr, p.id , nil , p.pack(...)),"call to invalid address") + local session = c.send(addr, p.id , nil , p.pack(...)) + if session == nil then + error("call to invalid address " .. tostring(addr)) + end return p.unpack(yield_call(addr, session)) end @@ -319,7 +322,7 @@ function skynet.blockcall(addr, typename , ...) local session = c.send(addr, p.id , nil , p.pack(...)) if session == nil then c.command("UNLOCK") - error("call to invalid address") + error("call to invalid address " .. tostring(addr)) end return p.unpack(yield_call(addr, session)) end diff --git a/service-src/service_client.c b/service-src/service_client.c index 1bc5c788..e31f9705 100644 --- a/service-src/service_client.c +++ b/service-src/service_client.c @@ -41,6 +41,8 @@ _cb(struct skynet_context * context, void * ud, int type, int session, uint32_t int client_init(struct client *c, struct skynet_context *ctx, const char * args) { int id = 0; + if (args == NULL) + return 1; sscanf(args, "%d",&id); c->id = id; skynet_callback(ctx, c, _cb); diff --git a/service-src/service_gate.c b/service-src/service_gate.c index 78d6c142..a97dfdcf 100644 --- a/service-src/service_gate.c +++ b/service-src/service_gate.c @@ -330,6 +330,8 @@ start_listen(struct gate *g, char * listen_addr) { int gate_init(struct gate *g , struct skynet_context * ctx, char * parm) { + if (parm == NULL) + return 1; int max = 0; int buffer = 0; int sz = strlen(parm)+1; diff --git a/skynet-src/skynet_harbor.c b/skynet-src/skynet_harbor.c index f188e252..023f1f6d 100644 --- a/skynet-src/skynet_harbor.c +++ b/skynet-src/skynet_harbor.c @@ -34,7 +34,8 @@ skynet_harbor_register(struct remote_name *rname) { int skynet_harbor_message_isremote(uint32_t handle) { - return (handle & ~HANDLE_MASK) != HARBOR; + int h = (handle & ~HANDLE_MASK); + return h != HARBOR && h !=0; } void diff --git a/skynet-src/skynet_server.c b/skynet-src/skynet_server.c index b6da1834..9b80b093 100644 --- a/skynet-src/skynet_server.c +++ b/skynet-src/skynet_server.c @@ -120,10 +120,11 @@ skynet_context_new(const char * name, const char *param) { } skynet_mq_force_push(queue); if (ret) { - printf("[:%x] launch %s %s\n",ret->handle, name, param ? param : ""); + skynet_error(ret, "LAUNCH %s %s", name, param ? param : ""); } return ret; } else { + skynet_error(ctx, "FAILED launch %s", name); skynet_context_release(ctx); skynet_handle_retire(ctx->handle); skynet_mq_release(queue); @@ -358,9 +359,11 @@ static void handle_exit(struct skynet_context * context, uint32_t handle) { if (handle == 0) { handle = context->handle; + skynet_error(context, "KILL self"); } if (G_NODE.monitor_exit) { skynet_send(context, handle, G_NODE.monitor_exit, PTYPE_CLIENT, 0, NULL, 0); + skynet_error(context, "KILL :%0x", handle); } skynet_handle_retire(handle); } @@ -476,7 +479,6 @@ skynet_command(struct skynet_context * context, const char * cmd , const char * args = strsep(&args, "\r\n"); struct skynet_context * inst = skynet_context_new(mod,args); if (inst == NULL) { - fprintf(stderr, "Launch %s %s failed\n",mod,args); return NULL; } else { _id_to_hex(context->result, inst->handle);