mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
fix client/watchdog
This commit is contained in:
@@ -28,14 +28,9 @@ _cb(struct skynet_context * context, void * ud, int type, int session, uint32_t
|
|||||||
|
|
||||||
int
|
int
|
||||||
client_init(struct client *c, struct skynet_context *ctx, const char * args) {
|
client_init(struct client *c, struct skynet_context *ctx, const char * args) {
|
||||||
int fd = 0, gate = 0, id = 0;
|
int id = 0;
|
||||||
// gate and id is unused now.
|
sscanf(args, "%d",&id);
|
||||||
sscanf(args, "%d %d %d",&fd,&gate,&id);
|
c->id = id;
|
||||||
if (gate == 0) {
|
|
||||||
skynet_error(ctx, "Invalid init client %s",args);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
c->id = fd;
|
|
||||||
skynet_callback(ctx, c, _cb);
|
skynet_callback(ctx, c, _cb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function command:open(parm)
|
|||||||
local fd,addr = string.match(parm,"(%d+) ([^%s]+)")
|
local fd,addr = string.match(parm,"(%d+) ([^%s]+)")
|
||||||
fd = tonumber(fd)
|
fd = tonumber(fd)
|
||||||
print("agent open",self,string.format("%d %d %s",self,fd,addr))
|
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))
|
local agent = skynet.launch("snlua","agent",skynet.address(client))
|
||||||
if agent then
|
if agent then
|
||||||
agent_all[self] = { agent , client }
|
agent_all[self] = { agent , client }
|
||||||
|
|||||||
Reference in New Issue
Block a user