ObjFW  Diff

Differences From Artifact [037c3906cf]:

To Artifact [bcc41be191]:

  • File src/OFDNSResolver.m — part of check-in [8f810ecb7e] at 2018-08-11 14:00:46 on branch trunk — Change the layout of of_socket_address_t

    Instead of containing a struct sockaddr_storage - which does not exist
    on all supported platforms - it now contains a union of all struct
    sockaddr_* types.

    Additionally, if struct sockaddr_in6 does not exist, it is defined so
    that an IPv6 can be stored even if the system does not support IPv6. (user: js, size: 33389) [annotate] [blame] [check-ins using]


1205
1206
1207
1208
1209
1210
1211

1212
1213

1214
1215
1216
1217
1218
1219
1220
1221
1222
1223

1224
1225
1226
1227
1228
1229
1230
1231

1232

1233
1234
1235
1236
1237
1238
1239
1240
1241
				  selector: @selector(of_queryWithIDTimedOut:)
				    object: ID
				   repeats: false]];

	address = of_socket_address_parse_ip(
	    [[query nameServers] firstObject], 53);


#ifdef OF_HAVE_IPV6
	if (address.address.ss_family == AF_INET6) {

		if (_IPv6Socket == nil) {
			_IPv6Socket = [[OFUDPSocket alloc] init];
			[_IPv6Socket bindToHost: @"::"
					   port: 0];
			[_IPv6Socket setBlocking: false];
		}

		sock = _IPv6Socket;
	} else {
#endif

		if (_IPv4Socket == nil) {
			_IPv4Socket = [[OFUDPSocket alloc] init];
			[_IPv4Socket bindToHost: @"0.0.0.0"
					   port: 0];
			[_IPv4Socket setBlocking: false];
		}

		sock = _IPv4Socket;

#ifdef OF_HAVE_IPV6

	}
#endif

	[sock asyncSendBuffer: [[query queryData] items]
		       length: [[query queryData] count]
		     receiver: address
		       target: self
		     selector: @selector(of_socket:didSendBuffer:bytesSent:
				   receiver:context:exception:)







>

<
>








|

>








>
|
>

<







1205
1206
1207
1208
1209
1210
1211
1212
1213

1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237

1238
1239
1240
1241
1242
1243
1244
				  selector: @selector(of_queryWithIDTimedOut:)
				    object: ID
				   repeats: false]];

	address = of_socket_address_parse_ip(
	    [[query nameServers] firstObject], 53);

	switch (address.family) {
#ifdef OF_HAVE_IPV6

	case OF_SOCKET_ADDRESS_FAMILY_IPV6:
		if (_IPv6Socket == nil) {
			_IPv6Socket = [[OFUDPSocket alloc] init];
			[_IPv6Socket bindToHost: @"::"
					   port: 0];
			[_IPv6Socket setBlocking: false];
		}

		sock = _IPv6Socket;
		break;
#endif
	case OF_SOCKET_ADDRESS_FAMILY_IPV4:
		if (_IPv4Socket == nil) {
			_IPv4Socket = [[OFUDPSocket alloc] init];
			[_IPv4Socket bindToHost: @"0.0.0.0"
					   port: 0];
			[_IPv4Socket setBlocking: false];
		}

		sock = _IPv4Socket;
		break;
	default:
		@throw [OFInvalidArgumentException exception];
	}


	[sock asyncSendBuffer: [[query queryData] items]
		       length: [[query queryData] count]
		     receiver: address
		       target: self
		     selector: @selector(of_socket:didSendBuffer:bytesSent:
				   receiver:context:exception:)