mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
client send session 0x7fffffff
This commit is contained in:
@@ -124,8 +124,8 @@ static void
|
||||
_forward(struct skynet_context * ctx,struct gate *g, int uid, void * data, size_t len) {
|
||||
struct connection * agent = _id_to_agent(g,uid);
|
||||
if (agent->agent) {
|
||||
// todo: client package has not session , send 0
|
||||
skynet_send(ctx, agent->client, agent->agent, 0, data, len, 0);
|
||||
// todo: client package has not session , send 0x7fffffff
|
||||
skynet_send(ctx, agent->client, agent->agent, 0x7fffffff, data, len, 0);
|
||||
} else {
|
||||
char * tmp = malloc(len + 32);
|
||||
int n = snprintf(tmp,len+32,"%d data ",uid);
|
||||
|
||||
@@ -88,6 +88,10 @@ skynet.tostring = assert(c.tostring)
|
||||
skynet.unpack = assert(c.unpack)
|
||||
|
||||
function skynet.call(addr, deseri , ...)
|
||||
if deseri == nil then
|
||||
local session = c.send(addr, -1, ...)
|
||||
return coroutine.yield("CALL", session)
|
||||
end
|
||||
local t = type(deseri)
|
||||
if t == "function" then
|
||||
local session = c.send(addr, -1, ...)
|
||||
|
||||
@@ -3,8 +3,7 @@ local client = ...
|
||||
|
||||
local session_id = 0
|
||||
skynet.filter(function (session, address , msg, sz)
|
||||
if address == client then
|
||||
assert(session == 0)
|
||||
if session == 0x7fffffff then
|
||||
print("client message",skynet.tostring(msg,sz))
|
||||
-- It's client, there is no session
|
||||
session_id = session_id + 1
|
||||
|
||||
@@ -95,7 +95,7 @@ skynet_context_new(const char * name, const char *param) {
|
||||
int
|
||||
skynet_context_newsession(struct skynet_context *ctx) {
|
||||
int session = ++ctx->session_id;
|
||||
if (session < 0) {
|
||||
if (session >= 0x7fffffff) {
|
||||
ctx->session_id = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user