Skip to content

Commit

Permalink
Extracted a method
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-plevako-badoo committed Aug 31, 2020
1 parent 5637fb6 commit 0e108f2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Server/CBXCUITestServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,7 @@ - (void)start {
NSError *error;
BOOL serverStarted = NO;

NSString *portNumberString = [NSProcessInfo.processInfo.environment objectForKey: @"CbxServerPort"];
NSUInteger port = (NSUInteger)[portNumberString integerValue];

if (port == 0) {
[self.server setPort:CBX_DEFAULT_SERVER_PORT];
} else {
[self.server setPort:port];
}
[self setServerPort];

DDLogDebug(@"Attempting to start the DeviceAgent server");
serverStarted = [self attemptToStartWithError:&error];
Expand Down Expand Up @@ -184,4 +177,15 @@ - (void)registerRoutes {
}
}

- (void) setServerPort {
NSString *portNumberString = [NSProcessInfo.processInfo.environment objectForKey: @"CbxServerPort"];
NSUInteger port = (NSUInteger)[portNumberString integerValue];

if (!portNumberString) {
[self.server setPort:CBX_DEFAULT_SERVER_PORT];
} else {
[self.server setPort:port];
}
}

@end

0 comments on commit 0e108f2

Please sign in to comment.