Commit 570214f1 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

HTTP Uploader: request port 80 first and fallback on 8888 or random on failure

parent a97e85d4
......@@ -91,18 +91,25 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE
[self.httpServer setDocumentRoot:docRoot];
[self.httpServer setPort:8888];
[self.httpServer setPort:80];
[self.httpServer setConnectionClass:[VLCHTTPConnection class]];
NSError *error = nil;
if(![self.httpServer start:&error])
{
if (error.code == 13) {
DDLogError(@"Port forbidden by OS, trying another one");
[self.httpServer setPort:8888];
if(![self.httpServer start:&error])
return true;
}
/* Address already in Use, take a random one */
if(error.code == 48) {
DDLogError(@"Address already in use, trying another one");
DDLogError(@"Port already in use, trying another one");
[self.httpServer setPort:0];
if([self.httpServer start:&error])
if(![self.httpServer start:&error])
return true;
}
DDLogError(@"Error starting HTTP Server: %@", error);
......
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