mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
delete unused feature : group/localcast/forward, etc
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
#ifndef SKYNET_LOCAL_CAST_H
|
||||
#define SKYNET_LOCAL_CAST_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct localcast {
|
||||
int n;
|
||||
const uint32_t * group;
|
||||
void *msg;
|
||||
size_t sz;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "skynet.h"
|
||||
#include "skynet_handle.h"
|
||||
#include "skynet_multicast.h"
|
||||
#include "localcast.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int
|
||||
_maincb(struct skynet_context * context, void * ud, int type, int session, uint32_t source, const void * msg, size_t sz) {
|
||||
const struct localcast *lc = msg;
|
||||
size_t s = lc->sz | type << HANDLE_REMOTE_SHIFT;
|
||||
struct skynet_multicast_message * mc = skynet_multicast_create(lc->msg, s, source);
|
||||
skynet_multicast_cast(context, mc, lc->group, lc->n);
|
||||
free((void *)lc->group);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
localcast_init(void * ud, struct skynet_context *ctx, const char * args) {
|
||||
skynet_callback(ctx, ud, _maincb);
|
||||
skynet_command(ctx, "REG", ".cast");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
|
||||
struct snlua {
|
||||
lua_State * L;
|
||||
const char * reload;
|
||||
struct skynet_context * ctx;
|
||||
struct tqueue * tq;
|
||||
int (*init)(struct snlua *l, struct skynet_context *ctx, const char * args);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#include "skynet.h"
|
||||
#include "skynet_handle.h"
|
||||
#include "skynet_multicast.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct skynet_multicast_group *
|
||||
multicast_create() {
|
||||
return skynet_multicast_newgroup();
|
||||
}
|
||||
|
||||
void
|
||||
multicast_release(struct skynet_multicast_group *g) {
|
||||
skynet_multicast_deletegroup(g);
|
||||
}
|
||||
|
||||
static int
|
||||
_maincb(struct skynet_context * context, void * ud, int type, int session, uint32_t source, const void * msg, size_t sz) {
|
||||
struct skynet_multicast_group *g = ud;
|
||||
if (type == PTYPE_SYSTEM) {
|
||||
char cmd = '\0';
|
||||
uint32_t handle = 0;
|
||||
sscanf(msg,"%c %x",&cmd,&handle);
|
||||
if (handle == 0) {
|
||||
skynet_error(context, "Invalid handle %s",msg);
|
||||
return 0;
|
||||
}
|
||||
switch (cmd) {
|
||||
case 'E':
|
||||
skynet_multicast_entergroup(g, handle);
|
||||
break;
|
||||
case 'L':
|
||||
skynet_multicast_leavegroup(g, handle);
|
||||
break;
|
||||
case 'C':
|
||||
skynet_command(context, "EXIT", NULL);
|
||||
break;
|
||||
default:
|
||||
skynet_error(context, "Invalid command %s",msg);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
sz |= type << HANDLE_REMOTE_SHIFT;
|
||||
struct skynet_multicast_message * mc = skynet_multicast_create(msg, sz, source);
|
||||
skynet_multicast_castgroup(context, g, mc);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
multicast_init(struct skynet_multicast_group *g, struct skynet_context *ctx, const char * args) {
|
||||
skynet_callback(ctx, g, _maincb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "skynet.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static int
|
||||
_cb(struct skynet_context * context, void * ud, int type, int session, uint32_t source, const void * msg, size_t sz) {
|
||||
uint32_t dest = (uint32_t)(uintptr_t)ud;
|
||||
skynet_forward(context, dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
tunnel_init(void * dummy, struct skynet_context *ctx, const char * args) {
|
||||
uint32_t dest = skynet_queryname(ctx, args);
|
||||
if (dest == 0) {
|
||||
skynet_error(ctx, "Can't create tunnel to %s",args);
|
||||
return 1;
|
||||
}
|
||||
|
||||
skynet_callback(ctx, (void*)(intptr_t)dest, _cb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user