Skip to content

Commit b9db15c

Browse files
dsward2dsward2
authored andcommitted
In WebServerConnection, the NSLog statement to log the path of a URL request checks for "/nowplayingstatus.html", and restricts the log output to only log the first consecutive request for /nowplayingstatus.html, which is requested several times per second.
In AppDelegate terminateTasks, the order of the task terminations was changed, and an unnecessary call to soxController terminateTasks was removed.
1 parent 5254764 commit b9db15c

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

LocalRadio/AppDelegate.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification
8181

8282
- (void)terminateTasks
8383
{
84+
[self.sdrController terminateTasks];
85+
8486
[self.ezStreamController terminateTasks];
8587

8688
[self.icecastController terminateTasks];
8789

88-
[self.soxController terminateTasks];
89-
90-
[self.sdrController terminateTasks];
90+
//[self.soxController terminateTasks]; // already handled by sdrController terminateTasks
9191

9292
[self updateCurrentTasksText];
9393
}

LocalRadio/WebServerConnection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
@property(strong) NSMutableData * bodyData;
2727

28+
@property (strong) NSString * previousPath;
29+
2830
@property(strong) NSMutableDictionary * constructFrequencyDictionary;
2931

3032
- (void)listenButtonClickedForFrequencyID:(NSString *)frequencyIDString;

LocalRadio/WebServerConnection.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,22 @@ - (BOOL)expectsRequestBodyFromMethod:(NSString *)method atPath:(NSString *)path
170170

171171
NSURL * pathURL = [NSURL URLWithString:path];
172172

173+
// TODO: remove this instrumentation, which logs the page request
173174
NSString * pathURLPath = [pathURL path];
174175
NSString * pathExtension = pathURLPath.pathExtension;
175176
if ([pathExtension isEqualToString:@"html"] == YES)
176177
{
177-
NSLog(@"WebServerConnection httpResponseForMethod:%@ URI:%@", method, path);
178+
if ([path isEqualToString:@"/nowplayingstatus.html"] == NO)
179+
{
180+
NSLog(@"WebServerConnection httpResponseForMethod:%@ URI:%@", method, path);
181+
}
182+
else if ([self.previousPath isEqualToString:@"/nowplayingstatus.html"] == NO)
183+
{
184+
// only log the first consecutive request for /nowplayingstatus.html, which is requested several times per second
185+
NSLog(@"WebServerConnection httpResponseForMethod:%@ URI:%@", method, path);
186+
}
178187
}
188+
self.previousPath = path;
179189

180190
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:pathURL
181191
resolvingAgainstBaseURL:NO];

0 commit comments

Comments
 (0)