mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
global group multicast
This commit is contained in:
@@ -135,7 +135,7 @@ _forward(struct skynet_context * ctx,struct gate *g, int uid, void * data, size_
|
||||
}
|
||||
struct connection * agent = _id_to_agent(g,uid);
|
||||
if (agent->agent) {
|
||||
// todo: client package has not session , send 0x7fffffff
|
||||
// client package has not session , send 0x7fffffff
|
||||
skynet_send(ctx, agent->client, agent->agent, SESSION_CLIENT, data, len, 0);
|
||||
} else if (g->watchdog) {
|
||||
char * tmp = malloc(len + 32);
|
||||
@@ -202,6 +202,7 @@ _cb(struct skynet_context * ctx, void * ud, int session, uint32_t source, const
|
||||
}
|
||||
// big-endian
|
||||
uint16_t len = plen[0] << 8 | plen[1];
|
||||
|
||||
void * data = mread_pull(m, len);
|
||||
if (data == NULL) {
|
||||
if (mread_closed(m)) {
|
||||
|
||||
10
gate/mread.c
10
gate/mread.c
@@ -276,7 +276,7 @@ mread_poll(struct mread_pool * self , int timeout) {
|
||||
socklen_t len = sizeof(struct sockaddr_in);
|
||||
int client_fd = accept(self->listen_fd , (struct sockaddr *)&remote_addr , &len);
|
||||
if (client_fd >= 0) {
|
||||
// printf("MREAD connect %s:%u (fd=%d)\n",inet_ntoa(remote_addr.sin_addr),ntohs(remote_addr.sin_port), client_fd);
|
||||
// printf("MREAD(%p) connect %s:%u (fd=%d)\n",self, inet_ntoa(remote_addr.sin_addr),ntohs(remote_addr.sin_port), client_fd);
|
||||
struct socket * s = _add_client(self, client_fd);
|
||||
if (s) {
|
||||
self->active = -1;
|
||||
@@ -390,6 +390,14 @@ mread_pull(struct mread_pool * self , int size) {
|
||||
for (;;) {
|
||||
int bytes = recv(s->fd, buffer, rd, MSG_DONTWAIT);
|
||||
if (bytes > 0) {
|
||||
/*
|
||||
printf("recv: [%d] ",s->fd);
|
||||
int i;
|
||||
for (i=0;i<bytes;i++) {
|
||||
printf("%02x ",(uint8_t*)buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
*/
|
||||
ringbuffer_resize(rb, blk , bytes);
|
||||
if (bytes < sz) {
|
||||
_link_node(rb, self->active, s , blk);
|
||||
|
||||
Reference in New Issue
Block a user