1.1 --- a/Bonjour/MYBonjourQuery.m Mon Apr 27 09:03:56 2009 -0700
1.2 +++ b/Bonjour/MYBonjourQuery.m Tue Jun 23 13:52:28 2009 -0700
1.3 @@ -105,31 +105,55 @@
1.4 uint32_t ttl,
1.5 void *context)
1.6 {
1.7 + MYBonjourQuery *query = context;
1.8 @try{
1.9 //LogTo(Bonjour, @"queryCallback for %@ (err=%i)", context,errorCode);
1.10 - if (errorCode)
1.11 - [(MYBonjourQuery*)context setError: errorCode];
1.12 - else
1.13 - [(MYBonjourQuery*)context priv_gotRecordBytes: rdata
1.14 - length: rdlen
1.15 - type: rrtype
1.16 - ttl: ttl
1.17 - flags: flags];
1.18 + if (!errorCode)
1.19 + [query priv_gotRecordBytes: rdata
1.20 + length: rdlen
1.21 + type: rrtype
1.22 + ttl: ttl
1.23 + flags: flags];
1.24 }catchAndReport(@"MYBonjourResolver query callback");
1.25 + [query gotResponse: errorCode];
1.26 }
1.27
1.28
1.29 -- (DNSServiceRef) createServiceRef {
1.30 - DNSServiceRef serviceRef = NULL;
1.31 +- (DNSServiceErrorType) createServiceRef: (DNSServiceRef*)sdRefPtr {
1.32 const char *fullName = _bonjourService.fullName.UTF8String;
1.33 if (fullName)
1.34 - self.error = DNSServiceQueryRecord(&serviceRef, 0,
1.35 - _bonjourService.interfaceIndex,
1.36 - fullName,
1.37 - _recordType, kDNSServiceClass_IN,
1.38 - &queryCallback, self);
1.39 - return serviceRef;
1.40 + return DNSServiceQueryRecord(sdRefPtr,
1.41 + kDNSServiceFlagsShareConnection,
1.42 + _bonjourService.interfaceIndex,
1.43 + fullName,
1.44 + _recordType, kDNSServiceClass_IN,
1.45 + &queryCallback, self);
1.46 + else
1.47 + return kDNSServiceErr_NoSuchName;
1.48 }
1.49
1.50
1.51 @end
1.52 +
1.53 +
1.54 +/*
1.55 + Copyright (c) 2009, Jens Alfke <jens@mooseyard.com>. All rights reserved.
1.56 +
1.57 + Redistribution and use in source and binary forms, with or without modification, are permitted
1.58 + provided that the following conditions are met:
1.59 +
1.60 + * Redistributions of source code must retain the above copyright notice, this list of conditions
1.61 + and the following disclaimer.
1.62 + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
1.63 + and the following disclaimer in the documentation and/or other materials provided with the
1.64 + distribution.
1.65 +
1.66 + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
1.67 + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1.68 + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRI-
1.69 + BUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1.70 + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1.71 + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1.72 + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
1.73 + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.74 + */