From a3a64c3a6802d990c1249cd87aef947b9d22f454 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Nov 2024 21:11:03 +0000 Subject: [PATCH] get PID from Environment.ProcessId --- OpenSim/Framework/Servers/ServerBase.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 8 ++++---- OpenSim/Server/Base/ServicesServerBase.cs | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 87eeb136b0..60a99890d5 100755 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -86,7 +86,7 @@ namespace OpenSim.Framework.Servers try { - string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); + string pidstring = Environment.ProcessId.ToString(); using (FileStream fs = File.Create(path)) { diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index ae38fb644e..17b9cee2a9 100755 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -226,11 +226,11 @@ namespace OpenSim throw new Exception("CombineContiguousRegions not suported"); } - string pidFile = startupConfig.GetString("PIDFile", String.Empty); - if (pidFile != String.Empty) + string pidFile = startupConfig.GetString("PIDFile", string.Empty); + if (pidFile.Length > 0) CreatePIDFile(pidFile); - userStatsURI = startupConfig.GetString("Stats_URI", String.Empty); + userStatsURI = startupConfig.GetString("Stats_URI", string.Empty); m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true); @@ -355,7 +355,7 @@ namespace OpenSim // Sure is not the right place for this but do the job... // Must always be called before (all) / the HTTP servers starting for the Certs creation or renewals. - if(startupConfig.GetBoolean("EnableSelfsignedCertSupport", false)) + if (startupConfig.GetBoolean("EnableSelfsignedCertSupport", false)) { if(!File.Exists("SSL\\ssl\\"+ startupConfig.GetString("CertFileName") +".p12") || startupConfig.GetBoolean("CertRenewOnStartup")) { diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 368dc36660..152018e6d5 100755 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -180,9 +180,10 @@ namespace OpenSim.Server.Base RegisterCommonAppenders(startupConfig); LogEnvironmentInformation(); - if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty) + string pidfile = startupConfig.GetString("PIDFile", string.Empty); + if (pidfile.Length > 0) { - CreatePIDFile(startupConfig.GetString("PIDFile")); + CreatePIDFile(pidfile); } RegisterCommonCommands();