Commit 06d1cdf5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Set the HTTP listening port to 8888

If it fails, take a random one
parent 1742238c
......@@ -36,7 +36,7 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE
-(BOOL)changeHTTPServerState:(BOOL)state
{
if(state) {
// To keep things simple and fast, we're just going to log to the Xcode console.
// Just log to the Xcode console.
[DDLog addLogger:[DDTTYLogger sharedInstance]];
// Initalize our http server
......@@ -52,12 +52,21 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE
DDLogInfo(@"Setting document root: %@", docRoot);
[self.httpServer setDocumentRoot:docRoot];
[self.httpServer setPort:8888];
[self.httpServer setConnectionClass:[VLCHTTPConnection class]];
NSError *error = nil;
if(![self.httpServer start:&error])
{
/* Address already in Use, take a random one */
if(error.code == 48) {
DDLogError(@"Address already in use, trying another one");
[self.httpServer setPort:0];
if([self.httpServer start:&error])
return true;
}
DDLogError(@"Error starting HTTP Server: %@", error);
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment