myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. b0c0c7ce4c


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. b0c0c7ce4c8aa1211a95408dd94b8c619516ef0c
Date: Tue, 11 Aug 2009 21:07:25 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  b0c0c7ce4c8aa1211a95408dd94b8c619516ef0c (commit)
       via  a941416962a473e4eb7336c98b2c15c071a20675 (commit)
       via  398e844152397ca4d3cd45053037c66a1b4fd0c4 (commit)
      from  0c8caa002f89f149ddf39bedad45a180d804a44b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit b0c0c7ce4c8aa1211a95408dd94b8c619516ef0c
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Aug 11 23:05:28 2009 +0200

    New LogManager method that allows to log according to a format string.

diff --git a/myserver/include/log/log_manager.h 
b/myserver/include/log/log_manager.h
index 2381d8c..36a5820 100644
--- a/myserver/include/log/log_manager.h
+++ b/myserver/include/log/log_manager.h
@@ -35,15 +35,18 @@ class LogManager
 public:
   LogManager (FiltersFactory* ff, LoggingLevel level = MYSERVER_LOG_MSG_INFO);
   ~LogManager ();
-  int add (void* owner, string type, string location, 
+  int add (void* owner, string type, string location,
            list<string>& filters, u_long cycle);
   int remove (void* owner);
   int log (void* owner, string message, bool appendNL = false,
            LoggingLevel level = MYSERVER_LOG_MSG_INFO);
   int log (void* owner, string type, string message, bool appendNL = false,
            LoggingLevel level = MYSERVER_LOG_MSG_INFO);
-  int log (void* owner, string type, string location, string message, 
+  int log (void* owner, string type, string location, string message,
            bool appendNL = false, LoggingLevel level = MYSERVER_LOG_MSG_INFO);
+  int log (void* owner, string type, string location, LoggingLevel level,
+           bool appendNL, const char *fmt, ...);
+
   int close (void* owner);
   int close (void* owner, string type);
   int close (void* owner, string type, string location);
@@ -75,9 +78,9 @@ public:
   list<string> getLoggingLevelsByNames ();
   map<LoggingLevel, string>& getLoggingLevels () { return loggingLevels; }
 private:
-  int notify (void* owner, string type, string location, LogStreamEvent evt, 
+  int notify (void* owner, string type, string location, LogStreamEvent evt,
               void* msg = 0, void* reply = 0);
-  int notify (void* owner, string type, LogStreamEvent evt, void* msg = 0, 
+  int notify (void* owner, string type, LogStreamEvent evt, void* msg = 0,
               void* reply = 0);
   int notify (void* owner, LogStreamEvent evt, void* msg = 0, void* reply = 0);
   int add (void* owner);
@@ -98,7 +101,7 @@ private:
    * anyway it is possible to share the same LogStream between more owners.
    */
   map<string, LogStream*> logStreams;
-  
+
   /*!
    * For each LogStream, store the list of objects that use it.
    */
@@ -113,7 +116,7 @@ private:
    * Store the newline string for the host operating system.
    */
   string newline;
-  
+
   /*!
    * Associate each LoggingLevel with its string representation.
    */
diff --git a/myserver/src/log/log_manager.cpp b/myserver/src/log/log_manager.cpp
index c845a7b..8efb396 100644
--- a/myserver/src/log/log_manager.cpp
+++ b/myserver/src/log/log_manager.cpp
@@ -17,6 +17,7 @@
 
 #include <include/log/log_manager.h>
 #include <include/server/server.h>
+#include <cstdarg>
 
 /*!
  * The constructor.
@@ -428,9 +429,9 @@ int
 LogManager::log (void* owner, string message, bool appendNL,
                  LoggingLevel level)
 {
-  int failure = 1;
+  int failure = 0;
   if (level < this->level)
-    return failure;
+    return 1;
 
   mutex->lock ();
   try
@@ -474,9 +475,9 @@ int
 LogManager::log (void* owner, string type, string message, bool appendNL,
                  LoggingLevel level)
 {
-  int failure = 1;
+  int failure = 0;
   if (level < this->level)
-    return failure;
+    return 1;
 
   mutex->lock ();
   try
@@ -524,9 +525,9 @@ int
 LogManager::log (void* owner, string type, string location, string message,
                  bool appendNL, LoggingLevel level)
 {
-  int failure = 1;
+  int failure = 0;
   if (level < this->level)
-    return failure;
+    return 1;
 
   mutex->lock ();
 
@@ -555,6 +556,104 @@ LogManager::log (void* owner, string type, string 
location, string message,
   return failure;
 }
 
+
+/*!
+ * Write a message on a single LogStream specifying a formatting string.
+ *
+ * \param owner The object that owns the LogStream.
+ * \param type The log category where we want to write.
+ * \param location The target LogStream.
+ * \param message The message we want to write.
+ * \param level The level of logging of this message. If it is less than
+ * the LogManager's level of logging, the message will be discarded.
+ * \param appendNL a flag that, if set, tells the LogManager to append
+ * a new line sequence to the message, according to the host operating system
+ * convention.
+ * \param fmt Specify the message to log, accepting an additional parameters
+ * list, codes accepted are:
+ * %s An const char* string.
+ * %S A string*
+ * %% A '%'.
+ * %i An integer.
+ *
+ * \return 0 on success, 1 on error.
+ */
+int
+LogManager::log (void* owner, string type, string location, LoggingLevel level,
+                 bool appendNL, const char *fmt, ...)
+{
+  int failure = 0;
+
+  if (level < this->level)
+    return 1;
+
+  mutex->lock ();
+
+  ostringstream oss;
+  va_list argptr;
+
+  va_start (argptr, fmt);
+
+  try
+    {
+      while (*fmt)
+        {
+          if (*fmt != '%')
+            oss << *fmt;
+          else
+            {
+              fmt++;
+              switch (*fmt)
+                {
+                case 's':
+                  oss << static_cast<const char*> (va_arg (argptr, const 
char*));
+                  break;
+
+                case 'S':
+                  oss << static_cast<string*> (va_arg (argptr, string*));
+                  break;
+
+                case '%':
+                  oss << '%';
+                  break;
+
+                case 'i':
+                  oss << static_cast<int> (va_arg (argptr, int));
+                  break;
+
+                default:
+                  mutex->unlock ();
+                  return 1;
+                }
+
+            }
+
+          fmt++;
+        }
+
+      string message = oss.str ();
+
+      failure = notify (owner, type, location, MYSERVER_LOG_EVT_SET_MODE,
+                        static_cast<void*>(&level))
+        || notify (owner, type, location, MYSERVER_LOG_EVT_LOG,
+                   static_cast<void*>(&message));
+
+      if (appendNL)
+        failure |= notify (owner, MYSERVER_LOG_EVT_LOG,
+                           static_cast<void*>(&newline));
+    }
+  catch (...)
+    {
+      mutex->unlock ();
+    }
+
+  va_end (argptr);
+
+  mutex->unlock ();
+  return failure;
+}
+
+
 /*!
  * Close all the LogStream objects owned by `owner'.
  *



commit a941416962a473e4eb7336c98b2c15c071a20675
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Aug 11 21:15:47 2009 +0200

    Limit usage of the same LogManager to only a thread at time.

diff --git a/myserver/src/log/log_manager.cpp b/myserver/src/log/log_manager.cpp
index 0db6c34..c845a7b 100644
--- a/myserver/src/log/log_manager.cpp
+++ b/myserver/src/log/log_manager.cpp
@@ -88,7 +88,7 @@ LogManager::clear ()
  * Add a new LogStream element to the LogManager. The same LogStream can be
  * shared between different owner objects. This means that you can pass
  * multiple times the same string as `location' parameter, as well as `owner'
- * and `type', but you can't pass more than one time the same 
+ * and `type', but you can't pass more than one time the same
  * <owner, type, location> tuple.
  *
  * \param owner The object that will own the LogStream that is being added.
@@ -100,7 +100,7 @@ LogManager::clear ()
  * \return 0 on success, 1 on error.
  */
 int
-LogManager::add (void* owner, string type, string location, 
+LogManager::add (void* owner, string type, string location,
                  list<string>& filters, u_long cycle)
 {
   mutex->lock ();
@@ -119,11 +119,11 @@ LogManager::add (void* owner, string type, string 
location,
       int oldSize;
       int newSize;
       ostringstream oss;
-      
+
       oldSize = logStreamOwners[location].size ();
       if (!contains (owner))
         {
-          failure = add (owner) || add (owner, type) || 
+          failure = add (owner) || add (owner, type) ||
             add (owner, type, location, logStreams[location]);
         }
       else if (!contains (owner, type))
@@ -235,7 +235,7 @@ LogManager::add (void* owner, string type, string location, 
LogStream* ls)
  *
  * \return 0 on success, 1 on error.
  */
-int 
+int
 LogManager::remove (void* owner)
 {
   mutex->lock ();
@@ -283,7 +283,7 @@ LogManager::remove (void* owner)
  * \return 0 on success, 1 on error.
  */
 int
-LogManager::notify (void* owner, string type, string location, 
+LogManager::notify (void* owner, string type, string location,
                     LogStreamEvent evt, void* message, void* reply)
 {
   int failure = 1;
@@ -308,7 +308,7 @@ LogManager::notify (void* owner, string type, string 
location,
  * \return 0 on success, 1 on error.
  */
 int
-LogManager::notify (void* owner, string type, LogStreamEvent evt, 
+LogManager::notify (void* owner, string type, LogStreamEvent evt,
                     void* message, void* reply)
 {
   int failure = 1;
@@ -337,7 +337,7 @@ LogManager::notify (void* owner, string type, 
LogStreamEvent evt,
  * \return 0 on success, 1 on error.
  */
 int
-LogManager::notify (void* owner, LogStreamEvent evt, void* message, 
+LogManager::notify (void* owner, LogStreamEvent evt, void* message,
                     void* reply)
 {
   int failure = 1;
@@ -429,19 +429,30 @@ LogManager::log (void* owner, string message, bool 
appendNL,
                  LoggingLevel level)
 {
   int failure = 1;
-  if (level >= this->level)
+  if (level < this->level)
+    return failure;
+
+  mutex->lock ();
+  try
     {
-      failure = 
-        notify (owner, MYSERVER_LOG_EVT_SET_MODE, static_cast<void*>(&level)) 
||
-        notify (owner, MYSERVER_LOG_EVT_LOG, static_cast<void*>(&message));
+      failure = notify (owner, MYSERVER_LOG_EVT_SET_MODE,
+                        static_cast<void*>(&level))
+        || notify (owner,MYSERVER_LOG_EVT_LOG, static_cast<void*>(&message));
       if (appendNL)
         {
           LoggingLevel l = MYSERVER_LOG_MSG_PLAIN;
-          failure |= 
-            (notify (owner, MYSERVER_LOG_EVT_SET_MODE, 
(static_cast<void*>(&l))) ||
-             notify (owner, MYSERVER_LOG_EVT_LOG, 
(static_cast<void*>(&newline))));
+          failure |= (notify (owner, MYSERVER_LOG_EVT_SET_MODE,
+                              (static_cast<void*>(&l)))
+                      || notify (owner, MYSERVER_LOG_EVT_LOG,
+                                 (static_cast<void*>(&newline))));
         }
     }
+  catch (...)
+    {
+      mutex->unlock ();
+    }
+  mutex->unlock ();
+
   return failure;
 }
 
@@ -464,19 +475,32 @@ LogManager::log (void* owner, string type, string 
message, bool appendNL,
                  LoggingLevel level)
 {
   int failure = 1;
-  if (level >= this->level)
+  if (level < this->level)
+    return failure;
+
+  mutex->lock ();
+  try
     {
-      failure = 
-        notify (owner, type, MYSERVER_LOG_EVT_SET_MODE, 
static_cast<void*>(&level)) ||
-        notify (owner, type, MYSERVER_LOG_EVT_LOG, 
static_cast<void*>(&message));
+      failure = notify (owner, type, MYSERVER_LOG_EVT_SET_MODE,
+                        static_cast<void*>(&level))
+        || notify (owner, type, MYSERVER_LOG_EVT_LOG,
+                   static_cast<void*>(&message));
+
       if (appendNL)
         {
           LoggingLevel l = MYSERVER_LOG_MSG_PLAIN;
-          failure |= 
-            (notify (owner, MYSERVER_LOG_EVT_SET_MODE, 
(static_cast<void*>(&l))) ||
-             notify (owner, MYSERVER_LOG_EVT_LOG, 
(static_cast<void*>(&newline))));
+          failure |= (notify (owner, MYSERVER_LOG_EVT_SET_MODE,
+                              (static_cast<void*>(&l)))
+                      || notify (owner, MYSERVER_LOG_EVT_LOG,
+                                 (static_cast<void*>(&newline))));
         }
     }
+  catch (...)
+    {
+      mutex->unlock ();
+    }
+  mutex->unlock ();
+
   return failure;
 }
 
@@ -497,23 +521,37 @@ LogManager::log (void* owner, string type, string 
message, bool appendNL,
  * \return 0 on success, 1 on error.
  */
 int
-LogManager::log (void* owner, string type, string location, string message, 
+LogManager::log (void* owner, string type, string location, string message,
                  bool appendNL, LoggingLevel level)
 {
   int failure = 1;
-  if (level >= this->level)
+  if (level < this->level)
+    return failure;
+
+  mutex->lock ();
+
+  try
     {
-      failure = 
-        notify (owner, type, location, MYSERVER_LOG_EVT_SET_MODE, 
static_cast<void*>(&level)) ||
-        notify (owner, type, location, MYSERVER_LOG_EVT_LOG, 
static_cast<void*>(&message));
+      failure = notify (owner, type, location, MYSERVER_LOG_EVT_SET_MODE,
+                        static_cast<void*>(&level))
+        || notify (owner, type, location, MYSERVER_LOG_EVT_LOG,
+                   static_cast<void*>(&message));
+
       if (appendNL)
         {
           LoggingLevel l = MYSERVER_LOG_MSG_PLAIN;
-          failure |=
-            (notify (owner, MYSERVER_LOG_EVT_SET_MODE, 
(static_cast<void*>(&l))) ||
-             notify (owner, MYSERVER_LOG_EVT_LOG, 
(static_cast<void*>(&newline))));
+          failure |= notify (owner, MYSERVER_LOG_EVT_SET_MODE,
+                             (static_cast<void*>(&l)))
+            || notify (owner, MYSERVER_LOG_EVT_LOG,
+                       static_cast<void*>(&newline));
         }
     }
+  catch (...)
+    {
+      mutex->unlock ();
+    }
+
+  mutex->unlock ();
   return failure;
 }
 
@@ -564,7 +602,7 @@ LogManager::close (void* owner, string type, string 
location)
 /*!
  * Set the cycle value for all the LogStream objects owned by `owner'.
  *
- * \param owner The object that wants to modify the cycle value for its 
+ * \param owner The object that wants to modify the cycle value for its
  * LogStream objects.
  * \param cycle The new cycle value.
  *
@@ -606,16 +644,16 @@ LogManager::setCycle (void* owner, string type, u_long 
cycle)
 int
 LogManager::setCycle (void* owner, string type, string location, u_long cycle)
 {
-  return notify (owner, type, location, MYSERVER_LOG_EVT_SET_CYCLE, 
+  return notify (owner, type, location, MYSERVER_LOG_EVT_SET_CYCLE,
                  static_cast<void*>(&cycle));
 }
 
 /*!
  * Return the cycle value for the `location' LogStream.
  *
- * \param location The LogStream about which we want to retrieve the cycle 
+ * \param location The LogStream about which we want to retrieve the cycle
  * value.
- * \param cycle On a successful method execution, the cycle value will be 
+ * \param cycle On a successful method execution, the cycle value will be
  * placed here.
  *
  * \return 0 on success, 1 on error.
@@ -784,7 +822,7 @@ LogManager::setFiltersFactory (FiltersFactory* ff)
  *
  * \return the FiltersFactory object used by the LogManager.
  */
-FiltersFactory* 
+FiltersFactory*
 LogManager::getFiltersFactory ()
 {
   return ff;
@@ -798,7 +836,7 @@ LogManager::getFiltersFactory ()
 bool
 LogManager::empty ()
 {
-  return 
+  return
     logStreams.size () == 0 &&
     owners.size () == 0 &&
     logStreamOwners.size () == 0;
@@ -816,7 +854,7 @@ LogManager::empty ()
 bool
 LogManager::contains (string location)
 {
-  return logStreams.count (location) > 0 && 
+  return logStreams.count (location) > 0 &&
     logStreamOwners[location].size ();
 }
 
@@ -864,7 +902,7 @@ bool
 LogManager::contains (void* owner, string type, string location)
 {
   return owners[owner][type].count (location) > 0 &&
-    (find (logStreamOwners[location].begin (), logStreamOwners[location].end 
(), owner) != 
+    (find (logStreamOwners[location].begin (), logStreamOwners[location].end 
(), owner) !=
      logStreamOwners[location].end ());
 }
 
@@ -877,7 +915,7 @@ LogManager::contains (void* owner, string type, string 
location)
  * \return The total number of LogStream objects belonging to all
  * its log categories.
  */
-int 
+int
 LogManager::count (void* owner)
 {
   int size = 0;
@@ -906,7 +944,7 @@ LogManager::count (void* owner, string type)
 }
 
 /*!
- * Given an owner object, one of its log categories and 
+ * Given an owner object, one of its log categories and
  * a location, returns the number of occurrences of `location'.
  *
  * \param owner A pointer to an object that may own `location'.
@@ -924,7 +962,7 @@ LogManager::count (void* owner, string type, string 
location)
 
 /*!
  * Retrieve a list of objects that are currently using `location'.
- * 
+ *
  * \param location We want to know which objects are using it.
  * \param l The location owners will be inserted here.
  *
@@ -966,7 +1004,7 @@ LogManager::logWriteln (string msg, LoggingLevel l)
 list<string>
 LogManager::getLoggingLevelsByNames ()
 {
-  list<string> l; 
+  list<string> l;
   for (map<LoggingLevel, string>::iterator it = loggingLevels.begin ();
        it != loggingLevels.end (); it++)
     {



commit 398e844152397ca4d3cd45053037c66a1b4fd0c4
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Aug 11 20:08:11 2009 +0200

    Removed MACRO defined constants.

diff --git a/myserver/include/connection/connection.h 
b/myserver/include/connection/connection.h
index 8b6cecd..6718786 100644
--- a/myserver/include/connection/connection.h
+++ b/myserver/include/connection/connection.h
@@ -36,15 +36,10 @@ class ClientsThread;
 
 using namespace std;
 
-/*! Remove the connection due a high server load.  */
-#define CONNECTION_REMOVE_OVERLOAD 1
-
-/*! Remove the connection if the administrator decided this.  */
-#define CONNECTION_USER_KILL        2
 
 
 class Connection;
-                                   
+
 typedef  Connection* ConnectionPtr;
 
 typedef int (*continuationPROC)(ConnectionPtr a, char *b1, char *b2,
@@ -54,6 +49,11 @@ typedef int (*continuationPROC)(ConnectionPtr a, char *b1, 
char *b2,
 class Connection
 {
 public:
+  enum
+    {
+      REMOVE_OVERLOAD = 1,
+      USER_KILL
+    };
   void init ();
   void destroy ();
 
@@ -69,7 +69,7 @@ public:
 
   u_short getPort ();
   void setPort (u_short);
-       
+
   u_short getLocalPort ();
   void setLocalPort (u_short);
 
@@ -94,15 +94,15 @@ public:
 
        /*! Connection socket.  */
        Socket *socket;
-       
+
        /*! Pointer to an host structure.  */
        Vhost *host;
-       
+
   int getToRemove ();
   void setToRemove (int);
 
   int isForceControl ();
-  void setForceControl (int);  
+  void setForceControl (int);
 
        /*! Buffer for the connection struct. Used by protocols.  */
        ProtocolBuffer *protocolBuffer;
@@ -134,7 +134,7 @@ public:
 
   MemBuf *getConnectionBuffer (){return connectionBuffer;}
 protected:
-       
+
        /*! This buffer must be used only by the ClientsTHREAD class.  */
        MemBuf *connectionBuffer;
 
@@ -154,7 +154,7 @@ protected:
 
        /*! Login name.  */
        string *login;
-       
+
        /*! Password used to log in.  */
        string *password;
 
@@ -163,7 +163,7 @@ protected:
 
        /*! Remote IP address.  */
        string *ipAddr;
-       
+
        /*! Local IP used to connect to.  */
        string *localIpAddr;
 
@@ -176,11 +176,11 @@ protected:
        /*
    *!If nonzero the server is saying to the protocol to remove the connection.
    *Protocols can not consider this but is a good idea do it to avoid server
-   *overloads. 
-   *Reasons to remove the connection are defined at the begin of this file.  
+   *overloads.
+   *Reasons to remove the connection are defined at the begin of this file.
    */
        int toRemove;
-       
+
        /*! Force the connection to be parsed.  */
        int forceControl;
 
diff --git a/myserver/src/protocol/control/control_protocol.cpp 
b/myserver/src/protocol/control/control_protocol.cpp
index 994da2c..623918c 100755
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -232,21 +232,20 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *b1, char *b2,
 
   /* Is the specified command a know one? */
   int knownCommand;
-  if (a->getToRemove())
+  if (a->getToRemove ())
   {
-    switch(a->getToRemove())
+    switch (a->getToRemove ())
     {
       /* Remove the connection from the list. */
-      case CONNECTION_REMOVE_OVERLOAD:
-        sendResponse(b2, bs2, a, CONTROL_SERVER_BUSY, header, 0);
-        return 0;
-      default:
-        return 0;
+    case Connection::REMOVE_OVERLOAD:
+      sendResponse (b2, bs2, a, CONTROL_SERVER_BUSY, header, 0);
+      return 0;
+    default:
+      return 0;
     }
   }
 
-
-  ret = header.parse_header(b1, nbtr, &realHeaderLength);
+  ret = header.parse_header (b1, nbtr, &realHeaderLength);
 
   /*
    *On errors remove the connection from the connections list.
@@ -792,7 +791,7 @@ int ControlProtocol::visitConnection (ConnectionPtr con, 
void* argP)
     if (con->getID () == arg->id)
     {
       /* Define why the connection is killed.  */
-      con->setToRemove (CONNECTION_USER_KILL);
+      con->setToRemove (Connection::USER_KILL);
       return 1;
     }
   }
@@ -805,8 +804,8 @@ int ControlProtocol::visitConnection (ConnectionPtr con, 
void* argP)
 /*!
  *Return the requested file to the client.
  */
-int ControlProtocol::getFile (ConnectionPtr a, char* fn, File* in,
-                             File* out, char *b1,int bs1, ControlHeader& 
header )
+int ControlProtocol::getFile (ConnectionPtr a, char* fn, File* in, File* out,
+                              char *b1,int bs1, ControlHeader& header)
 {
   const char *filename = 0;
   File localfile;
diff --git a/myserver/src/protocol/ftp/ftp.cpp 
b/myserver/src/protocol/ftp/ftp.cpp
index 567e22b..2eb65cf 100755
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -336,7 +336,7 @@ int Ftp::controlConnection (ConnectionPtr pConnection, char 
*b1, char *b2,
     return ClientsThread::DELETE_CONNECTION;
 
   // check if ftp is busy(return 120) or unavailable(return 421)
-  if (pConnection->getToRemove () == CONNECTION_REMOVE_OVERLOAD)
+  if (pConnection->getToRemove () == Connection::REMOVE_OVERLOAD)
     {
       pFtpuserData->m_nFtpstate = FtpuserData::BUISY;
       // TODO: really compute busy time interval
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 917bffd..ac4e8fa 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -860,7 +860,7 @@ int Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
           switch (td->connection->getToRemove ())
             {
               /* Remove the connection from the list.  */
-            case CONNECTION_REMOVE_OVERLOAD:
+            case Connection::REMOVE_OVERLOAD:
               retvalue = raiseHTTPError (503);
               logHTTPaccess ();
               return ClientsThread::DELETE_CONNECTION;
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 5922a41..6585797 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -287,7 +287,7 @@ Server::~Server()
 
   if(ipAddresses)
     delete ipAddresses;
-  
+
   if (logManager)
     delete logManager;
 
@@ -400,12 +400,12 @@ int Server::postLoad()
    */
   memset(serverName, 0, HOST_NAME_MAX+1);
   Socket::gethostname(serverName, HOST_NAME_MAX);
-  
+
   buffer.assign(languageParser.getValue("MSG_GETNAME"));
   buffer.append(" ");
   buffer.append(serverName);
   logWriteln(buffer.c_str());
-  
+
   /*
    *Find the IP addresses of the local machine.
    */
@@ -415,7 +415,7 @@ int Server::postLoad()
   buffer.assign("Host: ");
   buffer.append(serverName);
   logWriteln(buffer.c_str() );
-  
+
   if(Socket::getLocalIPsList(*ipAddresses))
   {
     string msg;
@@ -439,7 +439,7 @@ int Server::postLoad()
     delete mimeManager;
 
   mimeManager = new MimeManager();
-  
+
   if(int nMIMEtypes = mimeManager->loadXML(mimeConfigurationFile->c_str()))
   {
     ostringstream stream;
@@ -452,26 +452,26 @@ int Server::postLoad()
   }
 
   nCPU << (u_int)getCPUCount();
-  
+
   strCPU.assign(languageParser.getValue("MSG_NUM_CPU"));
   strCPU.append(" ");
   strCPU.append(nCPU.str());
   logWriteln(strCPU.c_str());
-  
+
   connectionsScheduler.restart();
-  
+
   listenThreads.initialize(&languageParser);
-  
+
   if(vhostList)
     delete vhostList;
-  
+
   vhostList = new VhostManager(&listenThreads, logManager);
-  
+
   if(vhostList == NULL)
     return -1;
 
   getProcessServerManager()->load();
-    
+
   /* Load the home directories configuration.  */
   homeDir.load();
 
@@ -482,7 +482,7 @@ int Server::postLoad()
 
   if(path == 0)
     path = new string();
-  
+
   if(getdefaultwd(*path))
     return -1;
 
@@ -506,10 +506,10 @@ int Server::postLoad()
  */
 void Server::loadPlugins()
 {
-  string xml("xml"); 
+  string xml("xml");
   //FIXME: xmlV is never freed.
   XmlValidator *xmlV = new XmlValidator ();
-    
+
   validatorFactory.addValidator (xml, xmlV);
   authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlV);
 
@@ -536,7 +536,7 @@ void Server::loadPlugins()
   }
 
 
-  
+
   getPluginsManager()->preLoad(this, *externalPath);
   getPluginsManager()->load(this);
   getPluginsManager()->postLoad(this, &languageParser);
@@ -584,7 +584,7 @@ void Server::mainLoop()
         FilesUtility::getLastModTime(vhostConfigurationFile->c_str());
       time_t mimeConfNow =
         FilesUtility::getLastModTime(mimeConfigurationFile->c_str());
-      
+
       /* If a configuration file was modified reboot the server. */
       if(((mainConfTimeNow != -1) && (hostsConfTimeNow != -1)  &&
           (mimeConfNow != -1)) || toReboot)
@@ -646,7 +646,7 @@ void Server::mainLoop()
 
           connectionsScheduler.restart();
           listenThreads.initialize(&languageParser);
-            
+
           vhostList = new VhostManager(&listenThreads, logManager);
 
           if(vhostList == 0)
@@ -967,9 +967,9 @@ int Server::terminate ()
   nStaticThreads = 0;
   if (verbosity > 1)
     logWriteln ("MyServer is stopped");
-  
+
   logManager->clear ();
-  
+
   return 0;
 }
 
@@ -1471,11 +1471,11 @@ ConnectionPtr Server::addConnectionToList(Socket* s,
    *is bigger than it say to the protocol that will parse the connection
    *to remove it from the active connections list.
    */
-  if(maxConnections &&
-     ((u_long)connectionsScheduler.getConnectionsNumber() > maxConnections))
-    newConnection->setToRemove(CONNECTION_REMOVE_OVERLOAD);
+  if(maxConnections && ((u_long)connectionsScheduler.getConnectionsNumber ()
+                        > maxConnections))
+    newConnection->setToRemove (Connection::REMOVE_OVERLOAD);
 
-  connectionsScheduler.registerConnectionID(newConnection);
+  connectionsScheduler.registerConnectionID (newConnection);
 
   return newConnection;
 }
@@ -2028,7 +2028,7 @@ int Server::logWriteln(char const* str, LoggingLevel 
level)
 {
   if(!str)
     return 0;
-  
+
   /*
    *If the log receiver is not the console output a timestamp.
    */

-----------------------------------------------------------------------

Summary of changes:
 myserver/include/connection/connection.h           |   32 ++--
 myserver/include/log/log_manager.h                 |   15 +-
 myserver/src/log/log_manager.cpp                   |  227 ++++++++++++++++----
 myserver/src/protocol/control/control_protocol.cpp |   23 +-
 myserver/src/protocol/ftp/ftp.cpp                  |    2 +-
 myserver/src/protocol/http/http.cpp                |    2 +-
 myserver/src/server/server.cpp                     |   50 +++---
 7 files changed, 245 insertions(+), 106 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]