diff --git a/3rd/lua/lvm.c b/3rd/lua/lvm.c index 58ba7f29..3fa87cb1 100644 --- a/3rd/lua/lvm.c +++ b/3rd/lua/lvm.c @@ -200,18 +200,19 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key, for (loop = 0; loop < MAXTAGLOOP; loop++) { const TValue *tm; if (oldval != NULL) { - lua_assert(ttistable(t) && ttisnil(oldval)); + Table *h = hvalue(t); + lua_assert(ttisnil(oldval)); /* must check the metamethod */ - if ((tm = fasttm(L, hvalue(t)->metatable, TM_NEWINDEX)) == NULL && + if ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL && /* no metamethod; is there a previous entry in the table? */ (oldval != luaO_nilobject || /* no previous entry; must create one. (The next test is always true; we only need the assignment.) */ - (oldval = luaH_newkey(L, hvalue(t), key), 1))) { + (oldval = luaH_newkey(L, h, key), 1))) { /* no metamethod and (now) there is an entry with given key */ setobj2t(L, cast(TValue *, oldval), val); - invalidateTMcache(hvalue(t)); - luaC_barrierback(L, hvalue(t), val); + invalidateTMcache(h); + luaC_barrierback(L, h, val); return; } /* else will try the metamethod */ diff --git a/lualib/sproto.lua b/lualib/sproto.lua index 9c6524b2..3ae114bd 100644 --- a/lualib/sproto.lua +++ b/lualib/sproto.lua @@ -197,6 +197,7 @@ function host:dispatch(...) local bin = core.unpack(...) header_tmp.type = nil header_tmp.session = nil + header_tmp.ud = nil local header, size = core.decode(self.__package, bin, header_tmp) local content = bin:sub(size + 1) if header.type then @@ -207,9 +208,9 @@ function host:dispatch(...) result = core.decode(proto.request, content) end if header_tmp.session then - return "REQUEST", proto.name, result, gen_response(self, proto.response, header_tmp.session) + return "REQUEST", proto.name, result, gen_response(self, proto.response, header_tmp.session), header.ud else - return "REQUEST", proto.name, result + return "REQUEST", proto.name, result, nil, header.ud end else -- response @@ -217,19 +218,20 @@ function host:dispatch(...) local response = assert(self.__session[session], "Unknown session") self.__session[session] = nil if response == true then - return "RESPONSE", session + return "RESPONSE", session, nil, header.ud else local result = core.decode(response, content) - return "RESPONSE", session, result + return "RESPONSE", session, result, header.ud end end end function host:attach(sp) - return function(name, args, session) + return function(name, args, session, ud) local proto = queryproto(sp, name) header_tmp.type = proto.tag header_tmp.session = session + header_tmp.ud = ud local header = core.encode(self.__package, header_tmp) if session then diff --git a/skynet-src/skynet_mq.c b/skynet-src/skynet_mq.c index 157f33d8..0ddd9ee9 100644 --- a/skynet-src/skynet_mq.c +++ b/skynet-src/skynet_mq.c @@ -84,7 +84,7 @@ skynet_mq_create(uint32_t handle) { SPIN_INIT(q) // When the queue is create (always between service create and service init) , // set in_global flag to avoid push it to global queue . - // If the service init success, skynet_context_new will call skynet_mq_force_push to push it to global queue. + // If the service init success, skynet_context_new will call skynet_mq_push to push it to global queue. q->in_global = MQ_IN_GLOBAL; q->release = 0; q->overload = 0; diff --git a/skynet-src/socket_server.h b/skynet-src/socket_server.h index 41ef9cca..96e38980 100644 --- a/skynet-src/socket_server.h +++ b/skynet-src/socket_server.h @@ -16,7 +16,7 @@ struct socket_server; struct socket_message { int id; uintptr_t opaque; - int ud; // for accept, ud is listen id ; for data, ud is size of data + int ud; // for accept, ud is new connection id ; for data, ud is size of data char * data; };