Commit 7ded3960 authored by devsaurus's avatar devsaurus
Browse files

fix net hold/unhold

parent 3fb2c7d4
......@@ -677,10 +677,13 @@ int net_hold( lua_State *L ) {
if (!ud || ud->type != TYPE_TCP_CLIENT)
return luaL_error(L, "invalid user data");
if (!ud->client.hold && ud->netconn)
{
if (ud->client.hold == 0)
{
ud->client.hold = 1;
ud->client.num_held = 0;
}
}
return 0;
}
......@@ -690,9 +693,13 @@ int net_unhold( lua_State *L ) {
if (!ud || ud->type != TYPE_TCP_CLIENT)
return luaL_error(L, "invalid user data");
if (ud->client.hold && ud->netconn)
{
if (ud->client.hold != 0)
{
ud->client.hold = 0;
netconn_recved(ud->netconn, ud->client.num_held);
ud->client.num_held = 0;
}
}
return 0;
}
......@@ -1130,7 +1137,6 @@ static void lrecv_cb (lua_State *L, lnet_userdata *ud) {
if (ud->type == TYPE_TCP_CLIENT) {
if (ud->client.hold) {
netconn_recved(ud->netconn, 0);
ud->client.num_held += len;
} else {
netconn_recved(ud->netconn, len);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment