global group multicast

This commit is contained in:
云风
2012-08-30 23:31:33 +08:00
parent 161528e686
commit 1ee802c5c5
17 changed files with 285 additions and 40 deletions

View File

@@ -442,6 +442,19 @@ _remote_send_handle(struct harbor *h, struct skynet_context * context, uint32_t
return 0;
}
static void
_remote_register_name(struct harbor *h, struct skynet_context * context, const char name[GLOBALNAME_LENGTH], uint32_t handle) {
int i;
for (i=0;i<GLOBALNAME_LENGTH;i++) {
if (name[i] == '\0')
break;
}
if (handle != 0) {
_update_remote_name(h, context, name, handle);
}
_request_master(h,context,name,i,handle);
}
static int
_remote_send_name(struct harbor *h, struct skynet_context * context, uint32_t source, const char name[GLOBALNAME_LENGTH], int session, const char * msg, size_t sz) {
struct keyvalue * node = _hash_search(h->map, name);
@@ -457,23 +470,14 @@ _remote_send_name(struct harbor *h, struct skynet_context * context, uint32_t so
header.destination = 0;
header.session = (uint32_t)session;
_push_queue(node->queue, msg, sz, &header);
// 0 for request
_remote_register_name(h, context, name, 0);
return 1;
} else {
return _remote_send_handle(h, context, source, node->value, session, msg, sz);
}
}
static void
_remote_register_name(struct harbor *h, struct skynet_context * context, const char name[GLOBALNAME_LENGTH], uint32_t handle) {
int i;
for (i=0;i<GLOBALNAME_LENGTH;i++) {
if (name[i] == '\0')
break;
}
_update_remote_name(h, context, name, handle);
_request_master(h,context,name,i,handle);
}
static void
_report_local_address(struct harbor *h, struct skynet_context * context, const char * local_address, int harbor_id) {
size_t sz = strlen(local_address);