711
712
713
714
715
716
717
718
719
720
721
722
723
724
|
}
- (void)of_sendQueryForContext: (OFDNSResolverContext *)context
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
OFUDPSocket *sock;
OFString *nameServer;
[context->_cancelTimer invalidate];
[context->_cancelTimer release];
context->_cancelTimer = nil;
context->_cancelTimer = [[OFTimer alloc]
initWithFireDate: [OFDate dateWithTimeIntervalSinceNow:
context->_settings->_timeout]
|
>
>
>
|
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
|
}
- (void)of_sendQueryForContext: (OFDNSResolverContext *)context
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
OFUDPSocket *sock;
OFString *nameServer;
[_queries setObject: context
forKey: context->_ID];
[context->_cancelTimer invalidate];
[context->_cancelTimer release];
context->_cancelTimer = nil;
context->_cancelTimer = [[OFTimer alloc]
initWithFireDate: [OFDate dateWithTimeIntervalSinceNow:
context->_settings->_timeout]
|
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
|
@throw [OFOutOfRangeException exception];
context = [[[OFDNSResolverContext alloc]
initWithQuery: query
ID: ID
settings: _settings
delegate: delegate] autorelease];
[_queries setObject: context
forKey: ID];
[self of_sendQueryForContext: context
runLoopMode: runLoopMode];
objc_autoreleasePoolPop(pool);
}
- (void)of_contextTimedOut: (OFDNSResolverContext *)context
|
<
<
<
|
820
821
822
823
824
825
826
827
828
829
830
831
832
833
|
@throw [OFOutOfRangeException exception];
context = [[[OFDNSResolverContext alloc]
initWithQuery: query
ID: ID
settings: _settings
delegate: delegate] autorelease];
[self of_sendQueryForContext: context
runLoopMode: runLoopMode];
objc_autoreleasePoolPop(pool);
}
- (void)of_contextTimedOut: (OFDNSResolverContext *)context
|
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
|
@throw [OFInvalidServerReplyException exception];
/* Opcode */
if ((buffer[2] & 0x78) != (queryDataBuffer[2] & 0x78))
@throw [OFInvalidServerReplyException exception];
/* TC */
if (buffer[2] & 0x02)
@throw [OFTruncatedDataException exception];
/* RCODE */
switch (buffer[3] & 0x0F) {
case 0:
break;
case 1:
error = OF_DNS_RESOLVER_ERROR_SERVER_INVALID_FORMAT;
|
|
>
>
>
|
>
>
>
>
>
>
>
|
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
|
@throw [OFInvalidServerReplyException exception];
/* Opcode */
if ((buffer[2] & 0x78) != (queryDataBuffer[2] & 0x78))
@throw [OFInvalidServerReplyException exception];
/* TC */
if (buffer[2] & 0x02) {
of_run_loop_mode_t runLoopMode;
if (context->_settings->_usesTCP)
@throw [OFTruncatedDataException exception];
context->_settings->_usesTCP = true;
runLoopMode = [OFRunLoop currentRunLoop].currentMode;
[self of_sendQueryForContext: context
runLoopMode: runLoopMode];
return false;
}
/* RCODE */
switch (buffer[3] & 0x0F) {
case 0:
break;
case 1:
error = OF_DNS_RESOLVER_ERROR_SERVER_INVALID_FORMAT;
|