[39693] branches/gsoc08-framework/MacPorts_Framework_Release

armahg at macports.org armahg at macports.org
Sun Aug 31 03:24:25 PDT 2008


Revision: 39693
          http://trac.macosforge.org/projects/macports/changeset/39693
Author:   armahg at macports.org
Date:     2008-08-31 03:24:23 -0700 (Sun, 31 Aug 2008)
Log Message:
-----------
MacPorts.Framework is now (basic) feature complete :). Creating IPC BSD socket files on the fly fixed IPC with helper tool bug where the IPC DoShout command failed to execute successfully if called successively without a long enough time interval between calls. Now time for code clean up, documentation and debugging

Modified Paths:
--------------
    branches/gsoc08-framework/MacPorts_Framework_Release/BetterAuthorizationSampleLib.c
    branches/gsoc08-framework/MacPorts_Framework_Release/MPHelperTool.m
    branches/gsoc08-framework/MacPorts_Framework_Release/MPInterpreter.m
    branches/gsoc08-framework/MacPorts_Framework_Release/MPNotifications+IPCAdditions.m

Modified: branches/gsoc08-framework/MacPorts_Framework_Release/BetterAuthorizationSampleLib.c
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/BetterAuthorizationSampleLib.c	2008-08-31 07:54:20 UTC (rev 39692)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/BetterAuthorizationSampleLib.c	2008-08-31 10:24:23 UTC (rev 39693)
@@ -1933,6 +1933,12 @@
     "	<key>OnDemand</key>\n"
     "	<true/>\n"
 
+	// We don't want our helper tool to be respawned every 10 seconds
+	// after a faliure ... hopefully this won't ALSO prevent us from
+	// rerunning the helper tool without rebooting the machine
+//	"	<key>LaunchOnlyOnce</key>\n"
+//	"	<true/>\n"
+
     // There are no program arguments, other that the path to the helper tool itself.
     //
     // IMPORTANT

Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPHelperTool.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPHelperTool.m	2008-08-31 07:54:20 UTC (rev 39692)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPHelperTool.m	2008-08-31 10:24:23 UTC (rev 39693)
@@ -49,6 +49,7 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <sys/param.h>
 #include <signal.h>
 
 
@@ -300,8 +301,14 @@
 		
         connReq.sun_len    = sizeof(connReq);
         connReq.sun_family = AF_UNIX;
-        strcpy(connReq.sun_path, kServerSocketPath);
+        //strcpy(connReq.sun_path, kServerSocketPath);
 		
+//		char testPath [MAXPATHLEN];
+//		strcpy(testPath, [ipcFilePath cStringUsingEncoding:NSUTF8StringEncoding]);
+		[ASLLogger logString:[NSString stringWithFormat:@"ipcFilePath is %@", ipcFilePath]];
+//		const char * testPath = [ipcFilePath cStringUsingEncoding:NSUTF8StringEncoding];
+		strcpy(connReq.sun_path, [ipcFilePath cStringUsingEncoding:NSUTF8StringEncoding]);
+		
         err = connect(conn->fSockFD, (struct sockaddr *) &connReq, SUN_LEN(&connReq));
         err = MoreUNIXErrno(err);
         
@@ -740,7 +747,7 @@
     // Connect to the server.
     if (err == 0) {
         err = ConnectionOpen(&nConn);
-		[ASLLogger logString:@"MPHelperTool: Installed Signal to Socket!"];
+		[ASLLogger logString:[NSString stringWithFormat:@"MPHelperTool: Installed Signal to Socket! %i", err]];
     }
 	
 	if (err == 0)
@@ -832,7 +839,7 @@
 			
 		}
 		else
-			[ASLLogger logString:[NSString stringWithFormat:@"notifier has value %@", notifier]];
+			[ASLLogger logString:[NSString stringWithFormat:@"notifier didn't connect has value %@", notifier]];
 		
 		//DoShout(iConn, log);
 		
@@ -896,12 +903,13 @@
 	//aslMsg may be null
 	
 	//Get the ipc file path
-	ipcFilePath = (NSString *) (CFStringRef)CFDictionaryGetValue(request, CFSTR(kServerFileSocketPath));
+	ipcFilePath = [[NSString alloc] initWithString:(NSString *) (CFStringRef)CFDictionaryGetValue(request, CFSTR(kServerFileSocketPath))];
 	if (ipcFilePath == nil) {
 		retval = coreFoundationUnknownErr;
 	}
 	else
 		CFDictionaryAddValue(response, CFSTR("SocketServerFilePath"), (CFStringRef)ipcFilePath);
+	[notifier initializeConnection];
 	
 	
 	//Get the string that was passed in the request dictionary
@@ -1097,8 +1105,8 @@
 //	
 	
 	notifier = [[NotificationsClient alloc] init];
-	[notifier initializeConnection];
 	
+	
 	int result = BASHelperToolMain(kMPHelperCommandSet, kMPHelperCommandProcs);
 	
 	// Clean up.
@@ -1108,6 +1116,7 @@
 	
 	[notifier closeConnection];
 	[notifier release];
+	[ipcFilePath release];
 	
 	[pool release];
 	

Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPInterpreter.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPInterpreter.m	2008-08-31 07:54:20 UTC (rev 39692)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPInterpreter.m	2008-08-31 10:24:23 UTC (rev 39693)
@@ -557,7 +557,7 @@
 		}
 	}
 	
-	NSLog(@"AFTER Tool Execution request is %@ , response is %@ \n\n", request, response);
+	//NSLog(@"AFTER Tool Execution request is %@ , response is %@ \n\n", request, response);
 	
 	return result;
 }

Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPNotifications+IPCAdditions.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPNotifications+IPCAdditions.m	2008-08-31 07:54:20 UTC (rev 39692)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPNotifications+IPCAdditions.m	2008-08-31 10:24:23 UTC (rev 39693)
@@ -1410,8 +1410,13 @@
 		NSLog(@"Creating Socket");
     }
     if (err == 0) {
-        err = SafeBindUnixDomainSocket(listenerFD, kServerSocketPath);
-        didBind = (err == 0);
+        //err = SafeBindUnixDomainSocket(listenerFD, kServerSocketPath);
+		NSLog(@"Socket file path is %@", socketFilePath);
+		
+		char testPath [MAXPATHLEN];
+		strcpy(testPath, [socketFilePath cStringUsingEncoding:NSUTF8StringEncoding]);
+        err = SafeBindUnixDomainSocket(listenerFD, [socketFilePath cStringUsingEncoding:NSUTF8StringEncoding]);
+		didBind = (err == 0);
 		NSLog(@"Binding Socket %i", err);
     }
     if (err == 0) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080831/cb8f1bf3/attachment.html 


More information about the macports-changes mailing list