@@ -41,6 +41,7 @@ bool AudioFileSourceHTTPStream::open(const char *url)
41
41
http.setReuse (true );
42
42
int code = http.GET ();
43
43
if (code != HTTP_CODE_OK) {
44
+ http.getStream ().flush (); // work around https://github.com/espressif/arduino-esp32/issues/828
44
45
http.end ();
45
46
cb.st (STATUS_HTTPFAIL, PSTR (" Can't open HTTP request" ));
46
47
return false ;
@@ -53,6 +54,7 @@ bool AudioFileSourceHTTPStream::open(const char *url)
53
54
54
55
AudioFileSourceHTTPStream::~AudioFileSourceHTTPStream ()
55
56
{
57
+ http.getStream ().flush (); // work around https://github.com/espressif/arduino-esp32/issues/828
56
58
http.end ();
57
59
}
58
60
@@ -79,6 +81,7 @@ uint32_t AudioFileSourceHTTPStream::readInternal(void *data, uint32_t len, bool
79
81
retry:
80
82
if (!http.connected ()) {
81
83
cb.st (STATUS_DISCONNECTED, PSTR (" Stream disconnected" ));
84
+ http.getStream ().flush (); // work around https://github.com/espressif/arduino-esp32/issues/828
82
85
http.end ();
83
86
for (int i = 0 ; i < reconnectTries; i++) {
84
87
char buff[32 ];
@@ -110,6 +113,7 @@ uint32_t AudioFileSourceHTTPStream::readInternal(void *data, uint32_t len, bool
110
113
size_t avail = stream->available ();
111
114
if (!nonBlock && !avail) {
112
115
cb.st (STATUS_NODATA, PSTR (" No stream data available" ));
116
+ http.getStream ().flush (); // work around https://github.com/espressif/arduino-esp32/issues/828
113
117
http.end ();
114
118
goto retry;
115
119
}
@@ -130,6 +134,7 @@ bool AudioFileSourceHTTPStream::seek(int32_t pos, int dir)
130
134
131
135
bool AudioFileSourceHTTPStream::close ()
132
136
{
137
+ http.getStream ().flush (); // work around https://github.com/espressif/arduino-esp32/issues/828
133
138
http.end ();
134
139
return true ;
135
140
}
0 commit comments