Explorar el Código

Increased Bonjour resolution timeout to 5 seconds

Pierre-Olivier Latour hace 10 años
padre
commit
aaf8679308
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      GCDWebServer/Core/GCDWebServer.m

+ 6 - 1
GCDWebServer/Core/GCDWebServer.m

@@ -48,6 +48,8 @@
 #define kDefaultPort 8080
 #define kDefaultPort 8080
 #endif
 #endif
 
 
+#define kBonjourResolutionTimeout 5.0
+
 NSString* const GCDWebServerOption_Port = @"Port";
 NSString* const GCDWebServerOption_Port = @"Port";
 NSString* const GCDWebServerOption_BonjourName = @"BonjourName";
 NSString* const GCDWebServerOption_BonjourName = @"BonjourName";
 NSString* const GCDWebServerOption_BonjourType = @"BonjourType";
 NSString* const GCDWebServerOption_BonjourType = @"BonjourType";
@@ -376,7 +378,10 @@ static void _NetServiceRegisterCallBack(CFNetServiceRef service, CFStreamError*
     } else {
     } else {
       GCDWebServer* server = (__bridge GCDWebServer*)info;
       GCDWebServer* server = (__bridge GCDWebServer*)info;
       GWS_LOG_VERBOSE(@"Bonjour registration complete for %@", [server class]);
       GWS_LOG_VERBOSE(@"Bonjour registration complete for %@", [server class]);
-      CFNetServiceResolveWithTimeout(server->_resolutionService, 1.0, NULL);
+      if (!CFNetServiceResolveWithTimeout(server->_resolutionService, kBonjourResolutionTimeout, NULL)) {
+        GWS_LOG_ERROR(@"Failed starting Bonjour resolution");
+        GWS_DNOT_REACHED();
+      }
     }
     }
   }
   }
 }
 }