ObjFW  Diff

Differences From Artifact [152a6730bc]:

To Artifact [d30e19048e]:

  • File src/OFDNSResolver.m — part of check-in [7460d2ccd8] at 2024-08-17 17:30:51 on branch trunk — Delay socket initialization as long as possible

    On game consoles, initializing sockets takes a significant amount of
    time. When not delaying socket initializing, that time is spent during
    startup even when the application might never use sockets.

    Worse yet, on Amiga, sockets might not be available at all and the
    application will fail to start up, even when the application might never
    use sockets. (user: js, size: 37266) [annotate] [blame] [check-ins using]


616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644




645
646
647
648
649
650
651
	[_cancelTimer release];

	[super dealloc];
}
@end

@implementation OFDNSResolver
#ifdef OF_AMIGAOS
+ (void)initialize
{
	if (self != [OFDNSResolver class])
		return;

	if (!_OFSocketInit())
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
}
#endif

+ (instancetype)resolver
{
	return [[[self alloc] init] autorelease];
}

- (instancetype)init
{
	self = [super init];

	@try {




		_settings = [[OFDNSResolverSettings alloc] init];
		_queries = [[OFMutableDictionary alloc] init];
		_TCPQueries = [[OFMutableDictionary alloc] init];
		_cache = [[OFMutableDictionary alloc] init];

		[_settings reload];
	} @catch (id e) {







<
<
<
<
<
<
<
<
<
<
<
<










>
>
>
>







616
617
618
619
620
621
622












623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
	[_cancelTimer release];

	[super dealloc];
}
@end

@implementation OFDNSResolver












+ (instancetype)resolver
{
	return [[[self alloc] init] autorelease];
}

- (instancetype)init
{
	self = [super init];

	@try {
		if (!_OFSocketInit())
			@throw [OFInitializationFailedException
			    exceptionWithClass: self.class];

		_settings = [[OFDNSResolverSettings alloc] init];
		_queries = [[OFMutableDictionary alloc] init];
		_TCPQueries = [[OFMutableDictionary alloc] init];
		_cache = [[OFMutableDictionary alloc] init];

		[_settings reload];
	} @catch (id e) {