Skip to content

Commit e0bb829

Browse files
committed
Merge branch 'explicit-close-on-response-finished-pull-try1' into yuboxfixes
2 parents f6fff3f + 3a406f8 commit e0bb829

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/WebRequest.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,16 @@ void AsyncWebServerRequest::_removeNotInterestingHeaders(){
189189

190190
void AsyncWebServerRequest::_onPoll(){
191191
//os_printf("p\n");
192-
if(_response != NULL && _client != NULL && _client->canSend() && !_response->_finished()){
193-
_response->_ack(this, 0, 0);
192+
if(_response != NULL && _client != NULL && _client->canSend()){
193+
if(!_response->_finished()){
194+
_response->_ack(this, 0, 0);
195+
} else {
196+
AsyncWebServerResponse* r = _response;
197+
_response = NULL;
198+
delete r;
199+
200+
_client->close();
201+
}
194202
}
195203
}
196204

@@ -199,10 +207,13 @@ void AsyncWebServerRequest::_onAck(size_t len, uint32_t time){
199207
if(_response != NULL){
200208
if(!_response->_finished()){
201209
_response->_ack(this, len, time);
202-
} else {
210+
}
211+
if(_response->_finished()){
203212
AsyncWebServerResponse* r = _response;
204213
_response = NULL;
205214
delete r;
215+
216+
_client->close();
206217
}
207218
}
208219
}

0 commit comments

Comments
 (0)