mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Avahi-based NSNetServices did crash upon publishing if Avahi daemon did not
run. Hardened code for this case which also works correctly if daemon is started later on. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39689 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dbe7cef25d
commit
cb3f465c10
2 changed files with 24 additions and 5 deletions
|
@ -881,7 +881,19 @@ didUpdateRecordData: (id)data
|
|||
}
|
||||
|
||||
//Create the entry group:
|
||||
_entryGroup = avahi_entry_group_new((AvahiClient*)_client, GSAvahiEntryGroupStateChanged, (void*)self);
|
||||
if (NULL != _client)
|
||||
{
|
||||
_entryGroup = avahi_entry_group_new((AvahiClient*)_client,
|
||||
GSAvahiEntryGroupStateChanged,
|
||||
(void*)self);
|
||||
}
|
||||
else
|
||||
{
|
||||
// having no _client usually means that avahi-daemon (or dbus)
|
||||
// isn't running, unfortunately there's no precise errNo at this point
|
||||
// so we're providing just our best guess
|
||||
return AVAHI_ERR_NO_DAEMON;
|
||||
}
|
||||
|
||||
// Handle error:
|
||||
if (NULL == _entryGroup)
|
||||
|
@ -1074,7 +1086,8 @@ didUpdateRecordData: (id)data
|
|||
{
|
||||
if (NO == [self addServiceRecordWithOptions: options])
|
||||
{
|
||||
[self handleError: avahi_client_errno((AvahiClient*)_client)];
|
||||
[self handleError: _client ? avahi_client_errno((AvahiClient*)_client)
|
||||
: AVAHI_ERR_NO_DAEMON];
|
||||
}
|
||||
}
|
||||
[self commitEntryGroup];
|
||||
|
@ -1219,7 +1232,7 @@ didUpdateRecordData: (id)data
|
|||
_entryGroup = NULL;
|
||||
}
|
||||
|
||||
if (0 != NSCountMapTable(_browsers))
|
||||
if ((_browsers != NULL) && (0 != NSCountMapTable(_browsers)))
|
||||
{
|
||||
NSMapTable *enumerationTable;
|
||||
NSMapEnumerator bEnum;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue