Skip to content

Commit bc086b1

Browse files
committed
fixing problem of missing connection after first iteration
1 parent 29066a3 commit bc086b1

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

libraries/WiFiS3/src/Modem.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ bool ModemClass::read_by_size_finished(string &rx) {
158158
string n = rx.substr(pos_space,pos);
159159
int to_be_rx = atoi(n.c_str());
160160
if(to_be_rx <= 0) {
161+
while( _serial->available() ){
162+
_serial->read();
163+
}
161164
rv = true;
162165
first_call = true;
163166
st = IDLE;
@@ -216,6 +219,9 @@ bool ModemClass::buf_read(const string &prompt, string &data_res) {
216219
if(data_res.size() > 0) {
217220
data_res = data_res.substr(0, data_res.length() - (sizeof(RESULT_OK) - 1));
218221
}
222+
else {
223+
break;
224+
}
219225
}
220226
}
221227
else {

libraries/WiFiS3/src/WiFiClient.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ int WiFiClient::_read() {
130130
}
131131
}
132132
else {
133-
this->flush();
134133
rv = 0;
135134
}
136135
}

libraries/WiFiS3/src/WiFiSSLClient.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int WiFiSSLClient::_read() {
131131
}
132132
}
133133
else {
134-
this->flush();
135134
rv = 0;
136135
}
137136
}

libraries/WiFiS3/src/WiFiUdp.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ int WiFiUDP::_read() {
187187
}
188188
}
189189
else {
190-
this->flush();
191190
rv = 0;
192191
}
193192
}

0 commit comments

Comments
 (0)