dummy session is 1

This commit is contained in:
Cloud Wu
2016-12-02 21:23:12 +08:00
parent a3eccf5e37
commit 7ee9cdb29b
2 changed files with 4 additions and 4 deletions

View File

@@ -171,18 +171,18 @@ _forward(struct gate *g, struct connection * c, int size) {
if (g->broker) { if (g->broker) {
void * temp = skynet_malloc(size); void * temp = skynet_malloc(size);
databuffer_read(&c->buffer,&g->mp,temp, 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; return;
} }
if (c->agent) { if (c->agent) {
void * temp = skynet_malloc(size); void * temp = skynet_malloc(size);
databuffer_read(&c->buffer,&g->mp,temp, 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) { } else if (g->watchdog) {
char * tmp = skynet_malloc(size + 32); char * tmp = skynet_malloc(size + 32);
int n = snprintf(tmp,32,"%d data ",c->id); int n = snprintf(tmp,32,"%d data ",c->id);
databuffer_read(&c->buffer,&g->mp,tmp+n,size); 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);
} }
} }

View File

@@ -22,7 +22,7 @@ function handler.message(fd, msg, sz)
local c = connection[fd] local c = connection[fd]
local agent = c.agent local agent = c.agent
if agent then if agent then
skynet.redirect(agent, c.client, "client", 0, msg, sz) skynet.redirect(agent, c.client, "client", 1, msg, sz)
else else
skynet.send(watchdog, "lua", "socket", "data", fd, netpack.tostring(msg, sz)) skynet.send(watchdog, "lua", "socket", "data", fd, netpack.tostring(msg, sz))
end end