Permalink
Browse files

Fixed(?) a Heisenbug in timedRead()

  • Loading branch information...
1 parent ed7ddd5 commit 22d4869ff615590541956d8ef79162c8253d52fb @PaintYourDragon PaintYourDragon committed Feb 20, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 Gutenbird.ino
View
@@ -347,10 +347,10 @@ int unidecode(byte len) {
int timedRead(void) {
int c;
unsigned long start = millis();
- do {
- if((c = client.read()) >= 0) return c;
- } while((millis() - start) < 5000L);
- return -1; // Timed out
+
+ while((!client.available()) && ((millis() - start) < 5000L));
+
+ return client.read(); // -1 on timeout
}
// ---------------------------------------------------------------------------

0 comments on commit 22d4869

Please sign in to comment.