Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
7ded3960
Commit
7ded3960
authored
Oct 20, 2018
by
devsaurus
Browse files
fix net hold/unhold
parent
3fb2c7d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/modules/net.c
View file @
7ded3960
...
@@ -678,8 +678,11 @@ int net_hold( lua_State *L ) {
...
@@ -678,8 +678,11 @@ int net_hold( lua_State *L ) {
return
luaL_error
(
L
,
"invalid user data"
);
return
luaL_error
(
L
,
"invalid user data"
);
if
(
!
ud
->
client
.
hold
&&
ud
->
netconn
)
if
(
!
ud
->
client
.
hold
&&
ud
->
netconn
)
{
{
ud
->
client
.
hold
=
1
;
if
(
ud
->
client
.
hold
==
0
)
ud
->
client
.
num_held
=
0
;
{
ud
->
client
.
hold
=
1
;
ud
->
client
.
num_held
=
0
;
}
}
}
return
0
;
return
0
;
}
}
...
@@ -691,8 +694,12 @@ int net_unhold( lua_State *L ) {
...
@@ -691,8 +694,12 @@ int net_unhold( lua_State *L ) {
return
luaL_error
(
L
,
"invalid user data"
);
return
luaL_error
(
L
,
"invalid user data"
);
if
(
ud
->
client
.
hold
&&
ud
->
netconn
)
if
(
ud
->
client
.
hold
&&
ud
->
netconn
)
{
{
ud
->
client
.
hold
=
0
;
if
(
ud
->
client
.
hold
!=
0
)
netconn_recved
(
ud
->
netconn
,
ud
->
client
.
num_held
);
{
ud
->
client
.
hold
=
0
;
netconn_recved
(
ud
->
netconn
,
ud
->
client
.
num_held
);
ud
->
client
.
num_held
=
0
;
}
}
}
return
0
;
return
0
;
}
}
...
@@ -1130,7 +1137,6 @@ static void lrecv_cb (lua_State *L, lnet_userdata *ud) {
...
@@ -1130,7 +1137,6 @@ static void lrecv_cb (lua_State *L, lnet_userdata *ud) {
if
(
ud
->
type
==
TYPE_TCP_CLIENT
)
{
if
(
ud
->
type
==
TYPE_TCP_CLIENT
)
{
if
(
ud
->
client
.
hold
)
{
if
(
ud
->
client
.
hold
)
{
netconn_recved
(
ud
->
netconn
,
0
);
ud
->
client
.
num_held
+=
len
;
ud
->
client
.
num_held
+=
len
;
}
else
{
}
else
{
netconn_recved
(
ud
->
netconn
,
len
);
netconn_recved
(
ud
->
netconn
,
len
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment