public void Run() { try { this.repoRegistry = new RepoRegistry(this.tracer, new PhysicalFileSystem(), this.serviceDataLocation); this.repoRegistry.Upgrade(); this.productUpgradeTimer.Start(); string pipeName = this.serviceName + ".Pipe"; this.tracer.RelatedInfo("Starting pipe server with name: " + pipeName); using (NamedPipeServer pipeServer = NamedPipeServer.StartNewServer(pipeName, this.tracer, this.HandleRequest)) { this.CheckEnableGitStatusCacheTokenFile(); using (ITracer activity = this.tracer.StartActivity("EnsurePrjFltHealthy", EventLevel.Informational)) { string error; EnableAndAttachProjFSHandler.TryEnablePrjFlt(activity, out error); } this.serviceStopped.WaitOne(); } } catch (Exception e) { this.LogExceptionAndExit(e, nameof(this.Run)); } }
public bool MountRepository(string repoRoot, int sessionId) { if (!ProjFSFilter.IsServiceRunning(this.tracer)) { string error; if (!EnableAndAttachProjFSHandler.TryEnablePrjFlt(this.tracer, out error)) { this.tracer.RelatedError($"{nameof(this.MountRepository)}: Could not enable PrjFlt: {error}"); return(false); } } using (CurrentUser currentUser = new CurrentUser(this.tracer, sessionId)) { if (!this.CallGVFSMount(repoRoot, currentUser)) { this.tracer.RelatedError($"{nameof(this.MountRepository)}: Unable to start the GVFS.exe process."); return(false); } string errorMessage; if (!GVFSEnlistment.WaitUntilMounted(repoRoot, false, out errorMessage)) { this.tracer.RelatedError(errorMessage); return(false); } } return(true); }
public bool Mount(string repoRoot) { if (!ProjFSFilter.IsServiceRunning(this.tracer)) { string error; if (!EnableAndAttachProjFSHandler.TryEnablePrjFlt(this.tracer, out error)) { this.tracer.RelatedError($"{nameof(this.Mount)}: Unable to start the GVFS.exe process: {error}"); } } if (!this.CallGVFSMount(repoRoot)) { this.tracer.RelatedError($"{nameof(this.Mount)}: Unable to start the GVFS.exe process."); return(false); } string errorMessage; if (!GVFSEnlistment.WaitUntilMounted(repoRoot, false, out errorMessage)) { this.tracer.RelatedError(errorMessage); return(false); } return(true); }
public void Run() { try { EventMetadata metadata = new EventMetadata(); metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion()); this.tracer.RelatedEvent(EventLevel.Informational, $"{nameof(GVFSService)}_{nameof(this.Run)}", metadata); this.repoRegistry = new RepoRegistry( this.tracer, new PhysicalFileSystem(), this.serviceDataLocation, new GVFSMountProcess(this.tracer), this.notificationHandler); this.repoRegistry.Upgrade(); this.requestHandler = new WindowsRequestHandler(this.tracer, EtwArea, this.repoRegistry); string pipeName = GVFSPlatform.Instance.GetGVFSServiceNamedPipeName(this.serviceName); this.tracer.RelatedInfo("Starting pipe server with name: " + pipeName); using (NamedPipeServer pipeServer = NamedPipeServer.StartNewServer( pipeName, this.tracer, this.requestHandler.HandleRequest)) { this.CheckEnableGitStatusCacheTokenFile(); using (ITracer activity = this.tracer.StartActivity("EnsurePrjFltHealthy", EventLevel.Informational)) { // Make a best-effort to enable PrjFlt. Continue even if it fails. // This will be tried again when user attempts to mount an enlistment. string error; EnableAndAttachProjFSHandler.TryEnablePrjFlt(activity, out error); } // Start product upgrade timer only after attempting to enable prjflt. // On Windows server (where PrjFlt is not inboxed) this helps avoid // a race between TryEnablePrjFlt() and installer pre-check which is // performed by UpgradeTimer in parallel. this.productUpgradeTimer.Start(); this.serviceStopped.WaitOne(); } } catch (Exception e) { this.LogExceptionAndExit(e, nameof(this.Run)); } }
public void Run() { try { EventMetadata metadata = new EventMetadata(); metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion()); this.tracer.RelatedEvent(EventLevel.Informational, $"{nameof(GVFSService)}_{nameof(this.Run)}", metadata); this.repoRegistry = new RepoRegistry( this.tracer, new PhysicalFileSystem(), Path.Combine(GVFSPlatform.Instance.GetCommonAppDataRootForGVFS(), this.serviceName), new GVFSMountProcess(this.tracer), this.notificationHandler); this.repoRegistry.Upgrade(); this.requestHandler = new WindowsRequestHandler(this.tracer, EtwArea, this.repoRegistry); string pipeName = GVFSPlatform.Instance.GetGVFSServiceNamedPipeName(this.serviceName); this.tracer.RelatedInfo("Starting pipe server with name: " + pipeName); using (NamedPipeServer pipeServer = NamedPipeServer.StartNewServer( pipeName, this.tracer, this.requestHandler.HandleRequest)) { this.CheckEnableGitStatusCacheTokenFile(); using (ITracer activity = this.tracer.StartActivity("EnsurePrjFltHealthy", EventLevel.Informational)) { // Make a best-effort to enable PrjFlt. Continue even if it fails. // This will be tried again when user attempts to mount an enlistment. string error; EnableAndAttachProjFSHandler.TryEnablePrjFlt(activity, out error); } this.serviceStopped.WaitOne(); } } catch (Exception e) { this.LogExceptionAndExit(e, nameof(this.Run)); } }