Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
4c4a6b8d
Commit
4c4a6b8d
authored
Aug 18, 2023
by
Tomas Pilny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reimplemented flush in WiFiClient
parent
099b432d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
20 deletions
+9
-20
libraries/WiFi/src/WiFiClient.cpp
libraries/WiFi/src/WiFiClient.cpp
+9
-20
No files found.
libraries/WiFi/src/WiFiClient.cpp
View file @
4c4a6b8d
...
...
@@ -153,6 +153,13 @@ public:
size_t
available
(){
return
_fill
-
_pos
+
r_available
();
}
void
flush
(){
if
(
r_available
()){
fillBuffer
();
}
_pos
=
_fill
;
}
};
class
WiFiClientSocketHandle
{
...
...
@@ -501,26 +508,8 @@ int WiFiClient::available()
// Though flushing means to send all pending data,
// seems that in Arduino it also means to clear RX
void
WiFiClient
::
flush
()
{
int
res
;
size_t
a
=
available
(),
toRead
=
0
;
if
(
!
a
){
return
;
//nothing to flush
}
uint8_t
*
buf
=
(
uint8_t
*
)
malloc
(
WIFI_CLIENT_FLUSH_BUFFER_SIZE
);
if
(
!
buf
){
return
;
//memory error
}
while
(
a
){
toRead
=
(
a
>
WIFI_CLIENT_FLUSH_BUFFER_SIZE
)
?
WIFI_CLIENT_FLUSH_BUFFER_SIZE
:
a
;
res
=
recv
(
fd
(),
buf
,
toRead
,
MSG_DONTWAIT
);
if
(
res
<
0
)
{
log_e
(
"fail on fd %d, errno: %d,
\"
%s
\"
"
,
fd
(),
errno
,
strerror
(
errno
));
stop
();
break
;
}
a
-=
res
;
}
free
(
buf
);
#ifdef ARDUINO_DEBUG_LEVEL
_rxBuffer
->
flush
();
}
uint8_t
WiFiClient
::
connected
()
...
...
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