Explorar el Código

automatische speicherabbild erstellung bei server crashes

Kolja Strohm hace 6 años
padre
commit
75acf35668
Se han modificado 4 ficheros con 19 adiciones y 10 borrados
  1. 2 2
      ShopServer/Datenbank.cpp
  2. 2 2
      ShopServer/ShopServer.cpp
  3. 10 6
      ShopServer/ShopServer.vcxproj
  4. 5 0
      ShopServer/main.cpp

+ 2 - 2
ShopServer/Datenbank.cpp

@@ -137,7 +137,7 @@ void ShSDatenbank::unregisterKlient( int num, int sNum )
 
 bool ShSDatenbank::setServerStatus( int id, int status )
 {
-    Text *befehl = new Text( "UPDATE server_shop SET server_status_id = " );
+    Text *befehl = new Text( "UPDATE server SET server_status_id = " );
     *befehl += status;
     *befehl += "WHERE id = ";
     *befehl += id;
@@ -536,7 +536,7 @@ bool ShSDatenbank::karteKaufen( int cId, int kId, bool testVersion )
 
 int ShSDatenbank::getUpdateKarte( int serverId )
 {
-    Text befehl = "SELECT a.id FROM karte a, karte_shop_update b WHERE b.karte_id = a.id AND a.server_shop_id = ";
+    Text befehl = "SELECT id FROM karte WHERE shop_update = true AND server_shop_id = ";
     befehl += serverId;
     lock();
     if( !datenbank->befehl( befehl ) )

+ 2 - 2
ShopServer/ShopServer.cpp

@@ -9,7 +9,7 @@ ShopServer::ShopServer( InitDatei *zIni )
     : Thread()
 {
     Network::Start( 100 );
-    std::cout << "IS: Verbindung mit Datenbank wird hergestellt...\n";
+    std::cout << "ShS: Verbindung mit Datenbank wird hergestellt...\n";
     db = new ShSDatenbank( zIni );
     klientAnzahl = 0;
     klients = new RCArray< ShSKlient >();
@@ -20,7 +20,7 @@ ShopServer::ShopServer( InitDatei *zIni )
     id = *zIni->zWert( "ServerId" );
     server = new Server();
     aServer = new Server();
-    std::cout << "IS: Starten des Admin Servers...\n";
+    std::cout << "ShS: Starten des Admin Servers...\n";
     if( !aServer->verbinde( (unsigned short)TextZuInt( ini->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
     {
         std::cout << "ShS: Der Admin Server konnte nicht gestartet werden. Das Programm wird beendet.\n";

+ 10 - 6
ShopServer/ShopServer.vcxproj

@@ -36,13 +36,17 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <TargetExt />
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Release</RemoteProjectDir>
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Release;..\..\..\..\Allgemein\Network\Network;../../../Network/Release;..\..\..\..\Allgemein\sql\sql;../../../sql/Release;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/release</RemoteProjectDir>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/release;..\..\..\..\Allgemein\Network\Network;../../../Network/release;..\..\..\..\Allgemein\sql\sql;../../../sql/release;$(IncludePath)</IncludePath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\release\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\release\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <TargetExt />
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Debug</RemoteProjectDir>
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Debug;..\..\..\..\Allgemein\Network\Network;../../../Network/Debug;..\..\..\..\Allgemein\sql\sql;../../../sql/Debug;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/debug</RemoteProjectDir>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/debug;..\..\..\..\Allgemein\Network\Network;../../../Network/debug;..\..\..\..\Allgemein\sql\sql;../../../sql/debug;$(IncludePath)</IncludePath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\debug\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\debug\</IntDir>
   </PropertyGroup>
   <ItemGroup>
     <ClCompile Include="Datenbank.cpp" />
@@ -57,7 +61,7 @@
   </ItemGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <Link>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Release/bin/x64/release;$(RemoteRootDir)/Network/Release/bin/x64/release;$(RemoteRootDir)/Framework/Release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/release/bin/x64/release;$(RemoteRootDir)/Network/release/bin/x64/release;$(RemoteRootDir)/Framework/release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>Framework;Network;SQL;pq;pthread</LibraryDependencies>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
     </Link>
@@ -65,7 +69,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <Link>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Debug/bin/x64/debug;$(RemoteRootDir)/Network/Debug/bin/x64/debug;$(RemoteRootDir)/Framework/Debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/debug/bin/x64/debug;$(RemoteRootDir)/Network/debug/bin/x64/debug;$(RemoteRootDir)/Framework/debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>dbgFramework;dbgNetwork;dbgSQL;pq;pthread</LibraryDependencies>
     </Link>
   </ItemDefinitionGroup>

+ 5 - 0
ShopServer/main.cpp

@@ -3,9 +3,14 @@
 #include <iostream>
 #include <fstream>
 #include <Globals.h>
+#include <sys/resource.h>
 
 int main()
 {
+	struct rlimit core_limits;
+	core_limits.rlim_cur = core_limits.rlim_max = RLIM_INFINITY;
+	setrlimit(RLIMIT_CORE, &core_limits);
+
     Framework::initFramework();
 	Zeit *z = getZeit();
 	Text *pfad = new Text( "../log/shop/" );