Merge branch 'master' into dev

This commit is contained in:
Cloud Wu
2014-10-23 15:25:25 +08:00

View File

@@ -240,6 +240,7 @@ filter_data_(lua_State *L, int fd, uint8_t * buffer, int size) {
buffer += need;
size -= need;
if (size == 0) {
if (q == NULL || q->head == q->tail ) {
lua_pushvalue(L, lua_upvalueindex(TYPE_DATA));
lua_pushinteger(L, fd);
lua_pushlightuserdata(L, uc->pack.buffer);
@@ -247,6 +248,12 @@ filter_data_(lua_State *L, int fd, uint8_t * buffer, int size) {
skynet_free(uc);
return 5;
}
else{
push_data(L, fd, uc->pack.buffer, uc->pack.size, 0);
skynet_free(uc);
return 1;
}
}
// more data
push_data(L, fd, uc->pack.buffer, uc->pack.size, 0);
skynet_free(uc);
@@ -274,6 +281,7 @@ filter_data_(lua_State *L, int fd, uint8_t * buffer, int size) {
}
if (size == pack_size) {
// just one package
if ( q == NULL || q->head == q->tail) {
lua_pushvalue(L, lua_upvalueindex(TYPE_DATA));
lua_pushinteger(L, fd);
void * result = skynet_malloc(pack_size);
@@ -282,6 +290,13 @@ filter_data_(lua_State *L, int fd, uint8_t * buffer, int size) {
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
push_data(L, fd, buffer, pack_size, 1);
buffer += pack_size;