added extra checks on DNS resolution for optimizations

removed logic to ignore 'access denied/file not found' - since we might just not have perms, but still want to show em!
This commit is contained in:
Patrick Wardle
2016-02-28 12:01:51 -10:00
parent 9585a14eb4
commit db915f26f5
4 changed files with 10 additions and 62 deletions
+8 -16
View File
@@ -53,19 +53,15 @@
//set icon
[self setConnectionIcon];
//resolve in background
//dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
//resolve
[self addressesForHost];
//resolve DNS names
if(nil != self.remoteIPAddr)
{
//resolve
[self addressesForHost];
}
//build/set connection string
[self setConnectionString];
//});
}
return self;
@@ -109,9 +105,8 @@
self.icon = [NSImage imageNamed:@"closedIcon"];
}
//TODO: set other icon?
//YES: close-wait!!!
//by design, other connection states won't have an icon
// TODO: maybe add other icons?
}
//set icon for UDP sockets
@@ -125,7 +120,6 @@
return;
}
//resolve a remote IP address to nice DNS name
// ->uses address and port, which are passed to getaddrinfo
// note: call from bg thread, cuz it can be slow due to DNS resolution(s)
@@ -143,7 +137,6 @@
return;
}
//build printable connection string
-(void)setConnectionString
{
@@ -169,7 +162,6 @@
return;
}
//convert Connection object to a JSON string
-(NSString*)toJSON
{
-14
View File
@@ -25,19 +25,6 @@
self = [super initWithParams:params];
if(self)
{
//always skip not-existent paths
if(YES != [[NSFileManager defaultManager] fileExistsAtPath:params[KEY_RESULT_PATH]])
{
//err msg
//syslog(LOG_ERR, "OBJECTIVE-SEE ERROR: %s not found", [params[KEY_RESULT_PATH] UTF8String]);
//set self to nil
self = nil;
//bail
goto bail;
}
//extract name
self.name = [[self.path lastPathComponent] stringByDeletingPathExtension];
@@ -46,7 +33,6 @@
//grab attributes
self.attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.path error:nil];
}
//bail
+2 -2
View File
@@ -153,10 +153,10 @@
installArgs[0] = "-R";
//2nd arg: permissions
// ->4 at front is setuid
// ->note: 4 at front is setuid
//TODO: change b4 release
// ->make 4755 before deploy (for testing, 777 makes Xcode be able to del it during build!)
installArgs[1] = "4777";
installArgs[1] = "4755";
//3rd arg: XPC service
installArgs[2] = [xpcService UTF8String];
-30
View File
@@ -525,29 +525,12 @@ bail:
//alloc/init File obj
file = [[File alloc] initWithParams:@{KEY_RESULT_PATH:filePath}];
//skip nil files
//TODO: look into what files err out!!
if(nil == file)
{
//next
continue;
}
//sync
@synchronized(self.files)
{
//add to task's files
[self.files addObject:file];
}
/*
//save new files
if(nil == [((AppDelegate*)[[NSApplication sharedApplication] delegate]).taskEnumerator.files objectForKey:filePath])
{
//save as new
[newFiles addObject:file];
}
*/
}
//sort by name
@@ -563,19 +546,6 @@ bail:
}//sync
/* ...don't need to process as search is done via task iteration
//process all new files
// ->determine type, etc & save into global list
for(File* newFile in newFiles)
{
//sync
@synchronized(((AppDelegate*)[[NSApplication sharedApplication] delegate]).taskEnumerator.files)
{
//save into global list
[((AppDelegate*)[[NSApplication sharedApplication] delegate]).taskEnumerator.files setObject:newFile forKey:filePath];
}
}
*/
}];
return;