Fixed behavior of GCDWebServerOption_BonjourName option

This commit is contained in:
Pierre-Olivier Latour
2014-11-19 09:01:57 +09:00
parent 14d538b0fb
commit 18889793b7
2 changed files with 2 additions and 2 deletions

View File

@@ -79,7 +79,7 @@ extern NSString* const GCDWebServerOption_Port;
* the name will automatically take the value of the GCDWebServerOption_ServerName
* option. If this option is set to nil, Bonjour will be disabled.
*
* The default value is an empty string.
* The default value is nil.
*/
extern NSString* const GCDWebServerOption_BonjourName;

View File

@@ -557,7 +557,7 @@ static inline NSString* _EncodeBase64(NSString* string) {
_source6 = [self _createDispatchSourceWithListeningSocket:listeningSocket6 isIPv6:YES];
_port = port;
NSString* bonjourName = _GetOption(_options, GCDWebServerOption_BonjourName, @"");
NSString* bonjourName = _GetOption(_options, GCDWebServerOption_BonjourName, nil);
NSString* bonjourType = _GetOption(_options, GCDWebServerOption_BonjourType, @"_http._tcp");
if (bonjourName) {
_registrationService = CFNetServiceCreate(kCFAllocatorDefault, CFSTR("local."), (__bridge CFStringRef)bonjourType, (__bridge CFStringRef)(bonjourName.length ? bonjourName : _serverName), (SInt32)_port);