@@ -112,25 +112,35 @@ DNSServiceProtocol GetProtocol(const chip::Inet::IPAddressType & addressType)
112
112
namespace chip {
113
113
namespace Dnssd {
114
114
115
- CHIP_ERROR GenericContext::Finalize (DNSServiceErrorType err)
115
+ CHIP_ERROR GenericContext::FinalizeInternal ( const char * errorStr, CHIP_ERROR err)
116
116
{
117
117
if (MdnsContexts::GetInstance ().Has (this ) == CHIP_NO_ERROR)
118
118
{
119
- if (kDNSServiceErr_NoError == err)
119
+ if (CHIP_NO_ERROR == err)
120
120
{
121
121
DispatchSuccess ();
122
122
}
123
123
else
124
124
{
125
- DispatchFailure (err);
125
+ DispatchFailure (errorStr, err);
126
126
}
127
127
}
128
128
else
129
129
{
130
130
chip::Platform::Delete (this );
131
131
}
132
132
133
- return Error::ToChipError (err);
133
+ return err;
134
+ }
135
+
136
+ CHIP_ERROR GenericContext::Finalize (CHIP_ERROR err)
137
+ {
138
+ return FinalizeInternal (err.AsString (), err);
139
+ }
140
+
141
+ CHIP_ERROR GenericContext::Finalize (DNSServiceErrorType err)
142
+ {
143
+ return FinalizeInternal (Error::ToString (err), Error::ToChipError (err));
134
144
}
135
145
136
146
MdnsContexts::~MdnsContexts ()
@@ -289,10 +299,10 @@ RegisterContext::RegisterContext(const char * sType, const char * instanceName,
289
299
mInstanceName = instanceName;
290
300
}
291
301
292
- void RegisterContext::DispatchFailure (DNSServiceErrorType err)
302
+ void RegisterContext::DispatchFailure (const char * errorStr, CHIP_ERROR err)
293
303
{
294
- ChipLogError (Discovery, " Mdns: Register failure (%s)" , Error::ToString (err) );
295
- callback (context, nullptr , nullptr , Error::ToChipError ( err) );
304
+ ChipLogError (Discovery, " Mdns: Register failure (%s)" , errorStr );
305
+ callback (context, nullptr , nullptr , err);
296
306
MdnsContexts::GetInstance ().Remove (this );
297
307
}
298
308
@@ -316,10 +326,10 @@ BrowseContext::BrowseContext(void * cbContext, DnssdBrowseCallback cb, DnssdServ
316
326
protocol = cbContextProtocol;
317
327
}
318
328
319
- void BrowseContext::DispatchFailure (DNSServiceErrorType err)
329
+ void BrowseContext::DispatchFailure (const char * errorStr, CHIP_ERROR err)
320
330
{
321
- ChipLogError (Discovery, " Mdns: Browse failure (%s)" , Error::ToString (err) );
322
- callback (context, nullptr , 0 , true , Error::ToChipError ( err) );
331
+ ChipLogError (Discovery, " Mdns: Browse failure (%s)" , errorStr );
332
+ callback (context, nullptr , 0 , true , err);
323
333
MdnsContexts::GetInstance ().Remove (this );
324
334
}
325
335
@@ -353,14 +363,14 @@ ResolveContext::ResolveContext(void * cbContext, DnssdResolveCallback cb, chip::
353
363
354
364
ResolveContext::~ResolveContext () {}
355
365
356
- void ResolveContext::DispatchFailure (DNSServiceErrorType err)
366
+ void ResolveContext::DispatchFailure (const char * errorStr, CHIP_ERROR err)
357
367
{
358
- ChipLogError (Discovery, " Mdns: Resolve failure (%s)" , Error::ToString (err) );
368
+ ChipLogError (Discovery, " Mdns: Resolve failure (%s)" , errorStr );
359
369
// Remove before dispatching, so calls back into
360
370
// ChipDnssdResolveNoLongerNeeded don't find us and try to also remove us.
361
371
bool needDelete = MdnsContexts::GetInstance ().RemoveWithoutDeleting (this );
362
372
363
- callback (context, nullptr , Span<Inet::IPAddress>(), Error::ToChipError ( err) );
373
+ callback (context, nullptr , Span<Inet::IPAddress>(), err);
364
374
365
375
if (needDelete)
366
376
{
0 commit comments