mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
message sequence wrong for queue
When the lua state yield in "more queue" proceeding, "data" comes, it should wait in queue, not immediatly do message process.
This commit is contained in:
@@ -240,12 +240,19 @@ filter_data_(lua_State *L, int fd, uint8_t * buffer, int size) {
|
|||||||
buffer += need;
|
buffer += need;
|
||||||
size -= need;
|
size -= need;
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
lua_pushvalue(L, lua_upvalueindex(TYPE_DATA));
|
if (q == NULL || q->head == q->tail ) {
|
||||||
lua_pushinteger(L, fd);
|
lua_pushvalue(L, lua_upvalueindex(TYPE_DATA));
|
||||||
lua_pushlightuserdata(L, uc->pack.buffer);
|
lua_pushinteger(L, fd);
|
||||||
lua_pushinteger(L, uc->pack.size);
|
lua_pushlightuserdata(L, uc->pack.buffer);
|
||||||
skynet_free(uc);
|
lua_pushinteger(L, uc->pack.size);
|
||||||
return 5;
|
skynet_free(uc);
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
push_data(L, fd, uc->pack.buffer, uc->pack.size, 0);
|
||||||
|
skynet_free(uc);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// more data
|
// more data
|
||||||
push_data(L, fd, uc->pack.buffer, uc->pack.size, 0);
|
push_data(L, fd, uc->pack.buffer, uc->pack.size, 0);
|
||||||
@@ -274,13 +281,21 @@ filter_data_(lua_State *L, int fd, uint8_t * buffer, int size) {
|
|||||||
}
|
}
|
||||||
if (size == pack_size) {
|
if (size == pack_size) {
|
||||||
// just one package
|
// just one package
|
||||||
lua_pushvalue(L, lua_upvalueindex(TYPE_DATA));
|
if ( q == NULL || q->head == q->tail) {
|
||||||
lua_pushinteger(L, fd);
|
lua_pushvalue(L, lua_upvalueindex(TYPE_DATA));
|
||||||
void * result = skynet_malloc(pack_size);
|
lua_pushinteger(L, fd);
|
||||||
memcpy(result, buffer, size);
|
void * result = skynet_malloc(pack_size);
|
||||||
lua_pushlightuserdata(L, result);
|
memcpy(result, buffer, size);
|
||||||
lua_pushinteger(L, size);
|
lua_pushlightuserdata(L, result);
|
||||||
return 5;
|
lua_pushinteger(L, size);
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
push_data(L, fd, buffer, pack_size, 1);
|
||||||
|
buffer += pack_size;
|
||||||
|
size -= pack_size;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// more data
|
// more data
|
||||||
push_data(L, fd, buffer, pack_size, 1);
|
push_data(L, fd, buffer, pack_size, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user