ObjFW  Diff

Differences From Artifact [8b4765d161]:

To Artifact [e03c4b06ca]:

  • File src/OFHTTPServer.m — part of check-in [3b43d51006] at 2020-01-14 00:16:04 on branch trunk — More consistent -[close] behavior

    This means refusing to close twice, calling -[close] from -[dealloc] and
    not calling -[cancelAsyncRequests].

    Calling -[cancelAsyncRequests] in -[close] is too dangerous, as -[close]
    gets called by -[dealloc]: If the queue is the last reference to the
    object, at the point where -[cancelAsyncRequests] removes it from the
    queue, the object will start to deallocate and call into
    -[cancelAsyncRequests] again, which is still in the middle of removing
    it and now finds itself with an inconsistent state. (user: js, size: 20441) [annotate] [blame] [check-ins using] [more...]


246
247
248
249
250
251
252
253

254
255
256
257
258
259
260
246
247
248
249
250
251
252

253
254
255
256
257
258
259
260







-
+








	return self;
}

- (void)dealloc
{
	if (_socket != nil)
		[self close];	/* includes [_socket release] */
		[self close];

	[_server release];
	[_request release];

	[super dealloc];
}

673
674
675
676
677
678
679

680

681
682
683
684
685
686
687
673
674
675
676
677
678
679
680

681
682
683
684
685
686
687
688







+
-
+







	}

	return self;
}

- (void)dealloc
{
	if (_socket != nil)
	[self close];
		[self close];

	[super dealloc];
}

- (bool)lowlevelIsAtEndOfStream
{
	return _atEndOfStream;
716
717
718
719
720
721
722



723
724


725
726
727
728
729
730
731
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737







+
+
+


+
+







- (int)fileDescriptorForReading
{
	return _socket.fileDescriptorForReading;
}

- (void)close
{
	if (_socket == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	[_socket release];
	_socket = nil;

	[super close];
}
@end

#ifdef OF_HAVE_THREADS
@implementation OFHTTPServerThread
- (void)stop
{