OSDN Git Service

ログの時刻をローカルタイムに変更
authorh2so5 <h2so5@git.sourceforge.jp>
Sat, 15 Sep 2012 09:28:56 +0000 (18:28 +0900)
committerh2so5 <h2so5@git.sourceforge.jp>
Sat, 15 Sep 2012 09:28:56 +0000 (18:28 +0900)
サーバーの安定化

common/Logger.hpp
server/Account.hpp
server/Server.cpp
server/main.cpp
server/version.hpp

index 20bd6ee..5e8d797 100644 (file)
@@ -24,14 +24,14 @@ class Logger {
                inline tstring GetTimeString() const
                {
                        using namespace boost::posix_time;
-                       ptime now = second_clock::universal_time();
+                       ptime now = second_clock::local_time();
             return unicode::ToTString(to_iso_extended_string(now));
                }
 
                inline std::string GetLogFileName() const
                {
                        using namespace boost::posix_time;
-                       ptime now = second_clock::universal_time();
+                       ptime now = second_clock::local_time();
                        std::string date_string = to_iso_extended_string(now);
                        boost::algorithm::replace_all(date_string, ":", "_");
             return "log_" + date_string + ".txt";
index 4c41324..4eab813 100644 (file)
@@ -56,6 +56,7 @@ class Account {
         void Set(UserID user_id, AccountProperty property, T value, bool revision = true)
         {
                        if (user_id == 0) {
+                               Logger::Error(_T("Invalid session id"));
                                return;
                        }
 
index e70eca9..422c4a8 100644 (file)
@@ -126,7 +126,7 @@ namespace network {
         });
         sessions_.erase(it, sessions_.end());
 
-               Logger::Info("Active sessoin: %d", sessions_.size() - 1);
+               Logger::Info("Active connection: %d", sessions_.size() - 1);
     }
 
     void Server::SendAll(const Command& command)
index 2447127..c915fd0 100644 (file)
@@ -71,7 +71,10 @@ int main(int argc, char* argv[])
         {
             if (auto session = c.session().lock()) {
                 unsigned int id = static_cast<unsigned int>(session->id());
-                               assert(id > 0);
+                               if (id == 0) {
+                                       Logger::Error(_T("Invalid session id"));
+                                       break;
+                               }
 
                 ptime now = second_clock::universal_time();
                 auto time_string = to_iso_extended_string(now);
index 3d1c887..fb60c50 100644 (file)
@@ -9,7 +9,7 @@
 
 #define MMO_VERSION_MAJOR 0
 #define MMO_VERSION_MINOR 1
-#define MMO_VERSION_REVISION 3
+#define MMO_VERSION_REVISION 4
 
 #ifdef MMO_VERSION_BUILD
 #define MMO_VERSION_BUILD_TEXT " Build " MMO_VERSION_TOSTRING(MMO_VERSION_BUILD)