mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
dummy session is 1
This commit is contained in:
@@ -171,18 +171,18 @@ _forward(struct gate *g, struct connection * c, int size) {
|
||||
if (g->broker) {
|
||||
void * temp = skynet_malloc(size);
|
||||
databuffer_read(&c->buffer,&g->mp,temp, size);
|
||||
skynet_send(ctx, 0, g->broker, g->client_tag | PTYPE_TAG_DONTCOPY, 0, temp, size);
|
||||
skynet_send(ctx, 0, g->broker, g->client_tag | PTYPE_TAG_DONTCOPY, 1, temp, size);
|
||||
return;
|
||||
}
|
||||
if (c->agent) {
|
||||
void * temp = skynet_malloc(size);
|
||||
databuffer_read(&c->buffer,&g->mp,temp, size);
|
||||
skynet_send(ctx, c->client, c->agent, g->client_tag | PTYPE_TAG_DONTCOPY, 0 , temp, size);
|
||||
skynet_send(ctx, c->client, c->agent, g->client_tag | PTYPE_TAG_DONTCOPY, 1 , temp, size);
|
||||
} else if (g->watchdog) {
|
||||
char * tmp = skynet_malloc(size + 32);
|
||||
int n = snprintf(tmp,32,"%d data ",c->id);
|
||||
databuffer_read(&c->buffer,&g->mp,tmp+n,size);
|
||||
skynet_send(ctx, 0, g->watchdog, PTYPE_TEXT | PTYPE_TAG_DONTCOPY, 0, tmp, size + n);
|
||||
skynet_send(ctx, 0, g->watchdog, PTYPE_TEXT | PTYPE_TAG_DONTCOPY, 1, tmp, size + n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ function handler.message(fd, msg, sz)
|
||||
local c = connection[fd]
|
||||
local agent = c.agent
|
||||
if agent then
|
||||
skynet.redirect(agent, c.client, "client", 0, msg, sz)
|
||||
skynet.redirect(agent, c.client, "client", 1, msg, sz)
|
||||
else
|
||||
skynet.send(watchdog, "lua", "socket", "data", fd, netpack.tostring(msg, sz))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user