Skip to content

Commit

Permalink
dummy session is 1
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Dec 2, 2016
1 parent a3eccf5 commit 7ee9cdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions service-src/service_gate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion service/gate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7ee9cdb

Please sign in to comment.