Differences From Artifact [c60b82a6b2]:
- File src/OFDNSResolver.m — part of check-in [6387b16864] at 2018-12-08 22:01:13 on branch trunk — Minor fix for OFDNSResolver and OFRunLoop (user: js, size: 60302) [annotate] [blame] [check-ins using]
To Artifact [15c765674a]:
- File
src/OFDNSResolver.m
— part of check-in
[064dbe5127]
at
2018-12-11 22:57:46
on branch trunk
— Include an exception in delegate methods
Otherwise, there would be two methods for every operation: One for
success and one for failure. It also makes it easy to forget about
handling failure, so it's better to always pass an optional exception. (user: js, size: 60197) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 | nil, nil, nil, query->_context, exception); } - (bool)socket: (OF_KINDOF(OFUDPSocket *))sock didReceiveIntoBuffer: (void *)buffer_ length: (size_t)length sender: (of_socket_address_t)sender { unsigned char *buffer = buffer_; OFDictionary *answerRecords = nil, *authorityRecords = nil; OFDictionary *additionalRecords = nil; OFNumber *ID; OFDNSResolverQuery *query; if (length < 2) /* We can't get the ID to get the query. Ignore packet. */ return true; ID = [OFNumber numberWithUInt16: (buffer[0] << 8) | buffer[1]]; query = [[[_queries objectForKey: ID] retain] autorelease]; | > > > > | 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | nil, nil, nil, query->_context, exception); } - (bool)socket: (OF_KINDOF(OFUDPSocket *))sock didReceiveIntoBuffer: (void *)buffer_ length: (size_t)length sender: (of_socket_address_t)sender exception: (id)exception { unsigned char *buffer = buffer_; OFDictionary *answerRecords = nil, *authorityRecords = nil; OFDictionary *additionalRecords = nil; OFNumber *ID; OFDNSResolverQuery *query; if (exception != nil) return true; if (length < 2) /* We can't get the ID to get the query. Ignore packet. */ return true; ID = [OFNumber numberWithUInt16: (buffer[0] << 8) | buffer[1]]; query = [[[_queries objectForKey: ID] retain] autorelease]; |
︙ | ︙ | |||
2008 2009 2010 2011 2012 2013 2014 | callback(query->_target, query->_selector, self, query->_domainName, answerRecords, authorityRecords, additionalRecords, query->_context, nil); return true; } | < < < < < < < | 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | callback(query->_target, query->_selector, self, query->_domainName, answerRecords, authorityRecords, additionalRecords, query->_context, nil); return true; } - (void)asyncResolveSocketAddressesForHost: (OFString *)host target: (id)target selector: (SEL)selector context: (id)context { [self asyncResolveSocketAddressesForHost: host addressFamily: OF_SOCKET_ADDRESS_FAMILY_ANY |
︙ | ︙ |