lib/avahi/Publisher: move code to RegisterServices(AvahiEntryGroup)
This commit is contained in:
		
				
					committed by
					
						
						Max Kellermann
					
				
			
			
				
	
			
			
			
						parent
						
							1b241fc97a
						
					
				
				
					commit
					4a14248004
				
			@@ -83,7 +83,7 @@ try {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* And recreate the services */
 | 
							/* And recreate the services */
 | 
				
			||||||
		RegisterServices(avahi_entry_group_get_client(g));
 | 
							RegisterServices(*g);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case AVAHI_ENTRY_GROUP_FAILURE:
 | 
						case AVAHI_ENTRY_GROUP_FAILURE:
 | 
				
			||||||
@@ -129,6 +129,16 @@ AddServices(AvahiEntryGroup &group,
 | 
				
			|||||||
		AddService(group, i, name);
 | 
							AddService(group, i, name);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					Publisher::RegisterServices(AvahiEntryGroup &g)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						AddServices(g, services, name.c_str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (int error = avahi_entry_group_commit(&g);
 | 
				
			||||||
 | 
						    error != AVAHI_OK)
 | 
				
			||||||
 | 
							throw MakeError(error, "Failed to commit Avahi service group");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
Publisher::RegisterServices(AvahiClient *c)
 | 
					Publisher::RegisterServices(AvahiClient *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -140,11 +150,7 @@ Publisher::RegisterServices(AvahiClient *c)
 | 
				
			|||||||
			throw MakeError(*c, "Failed to create Avahi service group");
 | 
								throw MakeError(*c, "Failed to create Avahi service group");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	AddServices(*group, services, name.c_str());
 | 
						RegisterServices(*group);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (int error = avahi_entry_group_commit(group.get());
 | 
					 | 
				
			||||||
	    error != AVAHI_OK)
 | 
					 | 
				
			||||||
		throw MakeError(error, "Failed to commit Avahi service group");
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,6 +68,7 @@ private:
 | 
				
			|||||||
				  AvahiEntryGroupState state,
 | 
									  AvahiEntryGroupState state,
 | 
				
			||||||
				  void *userdata) noexcept;
 | 
									  void *userdata) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void RegisterServices(AvahiEntryGroup &g);
 | 
				
			||||||
	void RegisterServices(AvahiClient *c);
 | 
						void RegisterServices(AvahiClient *c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* virtual methods from class AvahiConnectionListener */
 | 
						/* virtual methods from class AvahiConnectionListener */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user