File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,12 @@ size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
118
118
int EthernetUDP::parsePacket ()
119
119
{
120
120
// discard any remaining bytes in the last packet
121
- flush ();
121
+ while (_remaining) {
122
+ // could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
123
+ // should only occur if recv fails after telling us the data is there, lets
124
+ // hope the w5100 always behaves :)
125
+ read ();
126
+ }
122
127
123
128
if (recvAvailable (_sock) > 0 )
124
129
{
@@ -206,14 +211,7 @@ int EthernetUDP::peek()
206
211
207
212
void EthernetUDP::flush ()
208
213
{
209
- // could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
210
- // should only occur if recv fails after telling us the data is there, lets
211
- // hope the w5100 always behaves :)
212
-
213
- while (_remaining)
214
- {
215
- read ();
216
- }
214
+ // TODO: we should wait for TX buffer to be emptied
217
215
}
218
216
219
217
/* Start EthernetUDP socket, listening at local port PORT */
You can’t perform that action at this time.
0 commit comments