From dab0570936b8e7108ba6a7af0b691503feeb7456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E9=A3=8E?= Date: Sat, 24 Aug 2013 00:24:29 +0800 Subject: [PATCH] fix client/watchdog --- service-src/service_client.c | 11 +++-------- service/watchdog.lua | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/service-src/service_client.c b/service-src/service_client.c index 19e14e0e..d24b2ef2 100644 --- a/service-src/service_client.c +++ b/service-src/service_client.c @@ -28,14 +28,9 @@ _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 fd = 0, gate = 0, id = 0; - // gate and id is unused now. - sscanf(args, "%d %d %d",&fd,&gate,&id); - if (gate == 0) { - skynet_error(ctx, "Invalid init client %s",args); - return 1; - } - c->id = fd; + int id = 0; + sscanf(args, "%d",&id); + c->id = id; skynet_callback(ctx, c, _cb); return 0; diff --git a/service/watchdog.lua b/service/watchdog.lua index d5572335..674cb981 100644 --- a/service/watchdog.lua +++ b/service/watchdog.lua @@ -9,7 +9,7 @@ function command:open(parm) local fd,addr = string.match(parm,"(%d+) ([^%s]+)") fd = tonumber(fd) print("agent open",self,string.format("%d %d %s",self,fd,addr)) - local client = skynet.launch("client",fd, gate, self) + local client = skynet.launch("client",fd) local agent = skynet.launch("snlua","agent",skynet.address(client)) if agent then agent_all[self] = { agent , client }