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
3e60fa8f
Commit
3e60fa8f
authored
Sep 29, 2017
by
Johny Mattsson
Committed by
Marcel Stör
Sep 28, 2017
Browse files
Fix data loss in TCP streams. (#2097)
* Fix data loss in TCP streams. * Factored out the UDP extra args handling.
parent
119835bf
Changes
1
Show whitespace changes
Inline
Side-by-side
app/modules/net.c
View file @
3e60fa8f
...
@@ -202,20 +202,29 @@ static void net_recv_cb(lnet_userdata *ud, struct pbuf *p, ip_addr_t *addr, u16_
...
@@ -202,20 +202,29 @@ static void net_recv_cb(lnet_userdata *ud, struct pbuf *p, ip_addr_t *addr, u16_
pbuf_free
(
p
);
pbuf_free
(
p
);
return
;
return
;
}
}
lua_State
*
L
=
lua_getstate
();
int
num_args
=
2
;
int
num_args
=
2
;
char
iptmp
[
16
]
=
{
0
,
};
if
(
ud
->
type
==
TYPE_UDP_SOCKET
)
{
num_args
+=
2
;
ets_sprintf
(
iptmp
,
IPSTR
,
IP2STR
(
&
addr
->
addr
));
}
lua_State
*
L
=
lua_getstate
();
struct
pbuf
*
pp
=
p
;
while
(
pp
)
{
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
client
.
cb_receive_ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
client
.
cb_receive_ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
self_ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
self_ref
);
lua_pushlstring
(
L
,
p
->
payload
,
p
->
len
);
lua_pushlstring
(
L
,
p
p
->
payload
,
p
p
->
len
);
if
(
ud
->
type
==
TYPE_UDP_SOCKET
)
{
if
(
ud
->
type
==
TYPE_UDP_SOCKET
)
{
num_args
+=
2
;
char
iptmp
[
16
];
bzero
(
iptmp
,
16
);
ets_sprintf
(
iptmp
,
IPSTR
,
IP2STR
(
&
addr
->
addr
));
lua_pushinteger
(
L
,
port
);
lua_pushinteger
(
L
,
port
);
lua_pushstring
(
L
,
iptmp
);
lua_pushstring
(
L
,
iptmp
);
}
}
lua_call
(
L
,
num_args
,
0
);
lua_call
(
L
,
num_args
,
0
);
pp
=
pp
->
next
;
}
pbuf_free
(
p
);
pbuf_free
(
p
);
}
}
...
...
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