iClose socket if we end loading with an I/O operation in progress

This commit is contained in:
Richard Frith-Macdonald 2023-06-26 12:55:01 +01:00
parent e3b7fa5720
commit c6df659d35
2 changed files with 12 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2023-06-26 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSHTTPURLHandle.m: close socket if we end loading with an
I/O operation in progress.
2023-06-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSFileHandle.m: Fix to reliably remove handle from run loop

View file

@ -1075,14 +1075,19 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
NSResetMapTable(wProperties);
/* Socket must be removed from I/O notifications and connection state
* marked idle, but the socket is left open to be re-used for another
* request.
* marked idle, but the socket is already idle it may be re-used for
* another request.
*/
if (sock)
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc removeObserver: self name: nil object: sock];
if (connectionState != idle)
{
[sock closeFile]; // Close to cancel any I/O in progress
DESTROY(sock);
}
}
connectionState = idle;
[super endLoadInBackground];