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
4ece8de4
Commit
4ece8de4
authored
Dec 30, 2016
by
Johny Mattsson
Browse files
net module: hold/unhold support.
As per @djphoenix's work on the ESP8266 side.
parent
6bce18f9
Changes
1
Show whitespace changes
Inline
Side-by-side
components/modules/net.c
View file @
4ece8de4
...
...
@@ -279,7 +279,7 @@ static err_t net_tcp_recv_cb(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, er
}
if (post_net_recv (ud, p, 0, 0))
tcp_recved
(
tpcb
,
p
->
len
);
tcp_recved(tpcb,
ud->client.hold ? 0 : TCP_WND(tpcb)
);
return ERR_OK;
}
...
...
@@ -632,7 +632,10 @@ int net_hold( lua_State *L ) {
lnet_userdata *ud = net_get_udata(L);
if (!ud || ud->type != TYPE_TCP_CLIENT)
return luaL_error(L, "invalid user data");
if (!ud->client.hold && ud->tcp_pcb)
{
ud->client.hold = 1;
}
return 0;
}
...
...
@@ -641,7 +644,12 @@ int net_unhold( lua_State *L ) {
lnet_userdata *ud = net_get_udata(L);
if (!ud || ud->type != TYPE_TCP_CLIENT)
return luaL_error(L, "invalid user data");
if (ud->client.hold && ud->tcp_pcb)
{
ud->client.hold = 0;
ud->tcp_pcb->flags |= TF_ACK_NOW;
tcp_recved(ud->tcp_pcb, TCP_WND(ud->tcp_pcb));
}
return 0;
}
...
...
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