Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f032b82

Browse files
Merge pull request #458 from mgcookson/fix-wifi-read-timeout-when-zero-bytes-available
Fix 10 second delay in WiFiClient read methods when no data is available to read
2 parents 84d44b8 + f048f7f commit f032b82

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎libraries/WiFiS3/src/Modem.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,18 @@ ModemClass::ParseResult ModemClass::buf_read(const string &prompt, string &data_
289289
* in case multiple parameters separated by ',' are sent, they will be present in data_res
290290
* - if we encounter <CR> we need to wait for <LF>
291291
* - if we encounter <LF> we need to parse the response status
292-
* - if we encounter '|', the next token will contain binary sized data, the current value in
292+
* - if we encounter '|', the next token will contain binary sized data, the current value
293293
* in data_res contains the length of the next token
294294
*/
295295

296296
if(c == '|') { // sized read, the previous parameter is the length
297-
state = at_parse_state_t::Sized;
298-
299297
sized_read_size = atoi(data_res.c_str());
300298
data_res.clear();
299+
if (sized_read_size != 0) {
300+
state = at_parse_state_t::Sized;
301+
} else {
302+
state = at_parse_state_t::Res;
303+
}
301304
} else if(c == '\r') {
302305
state = at_parse_state_t::ResWaitLF;
303306
} else if(c == '\n') {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /