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. cc27550884


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. cc275508841c4d8c3195e6ee7ec1d521fd1c63fd
Date: Thu, 13 Aug 2009 21:22:27 +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  cc275508841c4d8c3195e6ee7ec1d521fd1c63fd (commit)
      from  6f9f8c5b6e38a19813f4408c6fad2edf5f24d065 (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 cc275508841c4d8c3195e6ee7ec1d521fd1c63fd
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Aug 13 23:21:00 2009 +0200

    Use the new Server logging functionality.

diff --git a/myserver/src/connections_scheduler/connections_scheduler.cpp 
b/myserver/src/connections_scheduler/connections_scheduler.cpp
index 853b327..b15cde0 100644
--- a/myserver/src/connections_scheduler/connections_scheduler.cpp
+++ b/myserver/src/connections_scheduler/connections_scheduler.cpp
@@ -22,52 +22,49 @@ static DEFINE_THREAD(dispatcher, p)
 {
   ConnectionsScheduler::DispatcherArg *da = 
(ConnectionsScheduler::DispatcherArg*)p;
 
-  if(da == NULL)
+  if (da == NULL)
     return NULL;
 
-  da->mutex->lock();
-  if(!da->terminated)
-  {
-    da->mutex->unlock();
-    return 0;
-  }
+  da->mutex->lock ();
+  if (!da->terminated)
+    {
+      da->mutex->unlock ();
+      return 0;
+    }
 
   da->terminated = false;
 
-  da->mutex->unlock();
+  da->mutex->unlock ();
 
-  while(!da->terminate)
-  {    
-    int res;
+  while (!da->terminate)
+    {
+      int res;
 
-    da->mutex->lock();
-    res = event_loop(EVLOOP_ONCE);
-    da->mutex->unlock();
+      da->mutex->lock ();
+      res = event_loop (EVLOOP_ONCE);
+      da->mutex->unlock ();
 
-    if(res == 1)
-    {
-      Thread::wait(10);
+      if (res == 1)
+        Thread::wait (10);
     }
 
-  }
-  
-  da->mutex->lock();
+  da->mutex->lock ();
   da->terminated = true;
-  da->mutex->unlock();
+  da->mutex->unlock ();
 
   return NULL;
 }
 
-static void newDataHandler(int fd, short event, void *param)
+static void newDataHandler (int fd, short event, void *param)
 {
   ConnectionsScheduler::DispatcherArg* arg = 
(ConnectionsScheduler::DispatcherArg*) param;
 
-  if(!arg->terminate && arg->scheduler)
-    arg->scheduler->newData(event, fd);
+  if (!arg->terminate && arg->scheduler)
+    arg->scheduler->newData (event, fd);
 }
 
 
-void ConnectionsScheduler::newData(short event, SocketHandle handle)
+void ConnectionsScheduler::newData (short event, SocketHandle handle)
 {
   ConnectionPtr connection = NULL;
 
@@ -76,25 +73,23 @@ void ConnectionsScheduler::newData(short event, 
SocketHandle handle)
   connectionsMutex.unlock();
 
 
-  if(connection == NULL || server == NULL)
+  if (connection == NULL || server == NULL)
     return;
 
-  if(event == EV_TIMEOUT)
-  {
-    if(!connection->allowDelete())
-      return;
+  if (event == EV_READ)
+    addReadyConnection (connection);
+  else if (event == EV_TIMEOUT)
+    {
+      if (!connection->allowDelete())
+        return;
 
-    server->notifyDeleteConnection(connection);
+      server->notifyDeleteConnection (connection);
 
-    removeConnection(connection);
-  }
-  else if(event == EV_READ)
-  {
-    addReadyConnection(connection);
-  }
+      removeConnection (connection);
+    }
 }
 
-static void eventLoopHandler(int fd, short event, void *arg)
+static void eventLoopHandler (int fd, short event, void *arg)
 {
   ConnectionsScheduler::DispatcherArg *da = 
(ConnectionsScheduler::DispatcherArg*)arg;
   u_long nbr;
@@ -109,11 +104,11 @@ static void eventLoopHandler(int fd, short event, void 
*arg)
       if (cmd == 'c')
       {
         /*
-         *Schedule a new connection.
-         *The 'c' command is followed by:
-         *SocketHandle  -> Socket to monitor for new data.
-         *ConnectionPtr -> Related Connection.
-         *timeval       -> Timeout.
+         * Schedule a new connection.
+         * The 'c' command is followed by:
+         * SocketHandle  -> Socket to monitor for new data.
+         * ConnectionPtr -> Related Connection.
+         * timeval       -> Timeout.
          */
         SocketHandle handle;
         ConnectionPtr c;
@@ -158,17 +153,17 @@ static void listenerHandler (int fd, short event, void 
*arg)
 }
 
 /*!
- *Add a listener socket to the event queue.
- *This is used to renew the event after the listener thread is notified.
+ * Add a listener socket to the event queue.
+ * This is used to renew the event after the listener thread is notified.
  *
- *\param la Structure containing an Event to be notified on new data.
+ * \param la Structure containing an Event to be notified on new data.
  */
-void ConnectionsScheduler::listener(ConnectionsScheduler::ListenerArg *la)
+void ConnectionsScheduler::listener (ConnectionsScheduler::ListenerArg *la)
 {
   ConnectionsScheduler::ListenerArg *arg = new 
ConnectionsScheduler::ListenerArg(la);
   static timeval tv = {3, 0};
 
-  event_set(&(arg->ev), (int) la->serverSocket->getHandle(), EV_READ | 
EV_TIMEOUT, 
+  event_set(&(arg->ev), (int) la->serverSocket->getHandle(), EV_READ | 
EV_TIMEOUT,
             listenerHandler, arg);
 
   arg->terminate = &dispatcherArg.terminate;
@@ -184,14 +179,14 @@ void 
ConnectionsScheduler::listener(ConnectionsScheduler::ListenerArg *la)
   Socket sock (dispatcherArg.socketPair.getSecondHandle ());
 
   eventsSocketMutex.lock();
-  sock.write("l", 1, &nbw);  
+  sock.write("l", 1, &nbw);
   eventsSocketMutex.unlock();
 }
 
 /*!
- *Remove a listener thread from the list.
+ * Remove a listener thread from the list.
  */
-void ConnectionsScheduler::removeListener(ConnectionsScheduler::ListenerArg* 
la)
+void ConnectionsScheduler::removeListener (ConnectionsScheduler::ListenerArg* 
la)
 {
   eventsMutex.lock();
   event_del(&(la->ev));
@@ -200,9 +195,9 @@ void 
ConnectionsScheduler::removeListener(ConnectionsScheduler::ListenerArg* la)
 }
 
 /*!
- *C'tor.
+ * C'tor.
  */
-ConnectionsScheduler::ConnectionsScheduler(Server* server)
+ConnectionsScheduler::ConnectionsScheduler (Server* server)
 {
   readyMutex.init();
   eventsMutex.init();
@@ -217,55 +212,55 @@ ConnectionsScheduler::ConnectionsScheduler(Server* server)
 }
 
 /*!
- *Get the number of all connections made to the server.
+ * Get the number of all connections made to the server.
  */
-u_long ConnectionsScheduler::getNumTotalConnections()
+u_long ConnectionsScheduler::getNumTotalConnections ()
 {
   return nTotalConnections;
 }
 
 
 /*!
- *Register the connection with a new ID.
- *\param connection The connection to register.
+ * Register the connection with a new ID.
+ * \param connection The connection to register.
  */
-void ConnectionsScheduler::registerConnectionID(ConnectionPtr connection)
+void ConnectionsScheduler::registerConnectionID (ConnectionPtr connection)
 {
-  connectionsMutex.lock();
-  connection->setID(nTotalConnections++);
-  connectionsMutex.unlock();
+  connectionsMutex.lock ();
+  connection->setID (nTotalConnections++);
+  connectionsMutex.unlock ();
 }
 
 /*!
- *Restart the scheduler.
+ * Restart the scheduler.
  */
-void ConnectionsScheduler::restart()
+void ConnectionsScheduler::restart ()
 {
-  readyMutex.init();
-  connectionsMutex.init();
-  eventsMutex.init();
-  listeners.clear();
+  readyMutex.init ();
+  connectionsMutex.init ();
+  eventsMutex.init ();
+  listeners.clear ();
 
-  if(readySemaphore)
+  if (readySemaphore)
     delete readySemaphore;
 
-  readySemaphore = new Semaphore(0);
+  readySemaphore = new Semaphore (0);
 
-  initialize();
+  initialize ();
 }
 
 /*!
- *Static initialization.
+ * Static initialization.
  */
-void ConnectionsScheduler::initialize()
+void ConnectionsScheduler::initialize ()
 {
   static int initialized = 0;
 
   if (!initialized)
-  {
-    event_init();
-    initialized = 1;
-  }
+    {
+      event_init ();
+      initialized = 1;
+    }
 
   dispatcherArg.terminated = true;
   dispatcherArg.terminate = false;
@@ -278,35 +273,33 @@ void ConnectionsScheduler::initialize()
   int err = dispatcherArg.socketPair.create ();
 
   if (err == -1)
-  {
-    if(server)
     {
-      server->logWriteln("Error initializing socket pair.", 
MYSERVER_LOG_MSG_ERROR);
+      if (server)
+        server->logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error initializing 
socket pair"));
+      return;
     }
-    return;
-  }
 
   event_set (&(dispatcherArg.loopEvent), 
dispatcherArg.socketPair.getFirstHandle (), EV_READ | EV_TIMEOUT,
-            eventLoopHandler, &dispatcherArg);
+             eventLoopHandler, &dispatcherArg);
 
   event_add (&(dispatcherArg.loopEvent), NULL);
 
   if (Thread::create (&dispatchedThreadId, dispatcher, &dispatcherArg))
-  {
-    if (server)
     {
-      server->logWriteln ("Error initializing dispatcher thread.", 
MYSERVER_LOG_MSG_ERROR);
+      if (server)
+        server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                            _("Error while initializing the dispatcher 
thread"));
+
+      dispatchedThreadId = 0;
     }
-    dispatchedThreadId = 0;
-  }
-  
+
   releasing = false;
 }
 
 /*!
- *D'tor.
+ * D'tor.
  */
-ConnectionsScheduler::~ConnectionsScheduler()
+ConnectionsScheduler::~ConnectionsScheduler ()
 {
   readyMutex.destroy();
   eventsMutex.destroy();
@@ -318,151 +311,149 @@ ConnectionsScheduler::~ConnectionsScheduler()
 
 
 /*!
- *Add an existent connection to ready connections queue.
+ * Add an existent connection to ready connections queue.
  */
-void ConnectionsScheduler::addReadyConnection(ConnectionPtr c)
+void ConnectionsScheduler::addReadyConnection (ConnectionPtr c)
 {
-  addReadyConnectionImpl(c);
+  addReadyConnectionImpl (c);
 }
 
 /*!
- *Add a new connection to ready connections queue.
+ * Add a new connection to ready connections queue.
  */
-void ConnectionsScheduler::addNewReadyConnection(ConnectionPtr c)
+void ConnectionsScheduler::addNewReadyConnection (ConnectionPtr c)
 {
-  addReadyConnectionImpl(c);
+  addReadyConnectionImpl (c);
 }
 
 
 /*!
- *Add a connection to ready connections queue.
+ * Add a connection to ready connections queue.
  */
-void ConnectionsScheduler::addReadyConnectionImpl(ConnectionPtr c)
+void ConnectionsScheduler::addReadyConnectionImpl (ConnectionPtr c)
 {
-  int priority = c->getPriority();
+  int priority = c->getPriority ();
 
-  if(priority == -1 && c->host)
-    priority = c->host->getDefaultPriority();
-    
-  priority = std::max(0, priority);
-  priority = std::min(PRIORITY_CLASSES - 1, priority);
+  if (priority == -1 && c->host)
+    priority = c->host->getDefaultPriority ();
 
-  c->setScheduled(1);
+  priority = std::max (0, priority);
+  priority = std::min (PRIORITY_CLASSES - 1, priority);
 
-  readyMutex.lock();
-  ready[priority].push(c);
-  readyMutex.unlock();
+  c->setScheduled (1);
 
-  if(server)
-    server->checkThreadsNumber();
+  readyMutex.lock ();
+  ready[priority].push (c);
+  readyMutex.unlock ();
 
-  readySemaphore->unlock();
+  if (server)
+    server->checkThreadsNumber ();
+
+  readySemaphore->unlock ();
 }
 
 /*!
- *Add a new connection to the scheduler.
+ * Add a new connection to the scheduler.
  */
-void ConnectionsScheduler::addNewWaitingConnection(ConnectionPtr c)
+void ConnectionsScheduler::addNewWaitingConnection (ConnectionPtr c)
 {
-  addWaitingConnectionImpl(c, 0);
+  addWaitingConnectionImpl (c, 0);
 }
 
 /*!
- *Reschedule a connection in the scheduler.
+ * Reschedule a connection in the scheduler.
  */
-void ConnectionsScheduler::addWaitingConnection(ConnectionPtr c)
+void ConnectionsScheduler::addWaitingConnection (ConnectionPtr c)
 {
-  addWaitingConnectionImpl(c, 1);
+  addWaitingConnectionImpl (c, 1);
 }
 
 /*!
- *Implementation to add a connection to waiting connections queue.
+ * Implementation to add a connection to waiting connections queue.
  */
-void ConnectionsScheduler::addWaitingConnectionImpl(ConnectionPtr c, int lock)
+void ConnectionsScheduler::addWaitingConnectionImpl (ConnectionPtr c, int lock)
 {
   static timeval tv = {10, 0};
-  SocketHandle handle = c->socket ? (SocketHandle) c->socket->getHandle() : 
NULL;
+  SocketHandle handle = c->socket ? (SocketHandle) c->socket->getHandle () : 
NULL;
 
   if(server)
-    tv.tv_sec = server->getTimeout() / 1000;
+    tv.tv_sec = server->getTimeout () / 1000;
   else
     tv.tv_sec = 30;
 
-  c->setScheduled(0);
+  c->setScheduled (0);
 
-  connectionsMutex.lock();
-  connections.put(handle, c);
-  connectionsMutex.unlock();
+  connectionsMutex.lock ();
+  connections.put (handle, c);
+  connectionsMutex.unlock ();
 
   /*
-   *If there is need to obtain the events lock don't block the current
-   *thread but send the 'c' message to the eventLoopHandler function,
-   *it will reschedule the connection from its thread context while it
-   *owns the lock.
+   * If there is need to obtain the events lock don't block the current
+   * thread but send the 'c' message to the eventLoopHandler function,
+   * it will reschedule the connection from its thread context while it
+   * owns the lock.
    */
-  if(lock)
-  {
-    u_long nbw;
-    Socket sock (dispatcherArg.socketPair.getSecondHandle ());
-
-    eventsSocketMutex.lock();
-    sock.write("c", 1, &nbw);
-    sock.write((char*)&handle, sizeof(SocketHandle), &nbw);
-    sock.write((char*)&c, sizeof(ConnectionPtr), &nbw);
-    sock.write((char*)&tv, sizeof(timeval), &nbw);
-    eventsSocketMutex.unlock();
-  }
+  if (lock)
+    {
+      u_long nbw;
+      Socket sock (dispatcherArg.socketPair.getSecondHandle ());
+
+      eventsSocketMutex.lock ();
+      sock.write ("c", 1, &nbw);
+      sock.write ((char*)&handle, sizeof(SocketHandle), &nbw);
+      sock.write ((char*)&c, sizeof(ConnectionPtr), &nbw);
+      sock.write ((char*)&tv, sizeof(timeval), &nbw);
+      eventsSocketMutex.unlock ();
+    }
   else
-  {
-    event_once((int)handle, EV_READ | EV_TIMEOUT, newDataHandler, 
&dispatcherArg, &tv);
-  }
+    event_once ((int)handle, EV_READ | EV_TIMEOUT, newDataHandler,
+                &dispatcherArg, &tv);
 }
 
 /*!
- *Get a connection from the active connections queue.
+ * Get a connection from the active connections queue.
  */
-ConnectionPtr ConnectionsScheduler::getConnection()
+ConnectionPtr ConnectionsScheduler::getConnection ()
 {
   ConnectionPtr ret = 0;
 
-  if(releasing)
+  if (releasing)
     return NULL;
 
-  readySemaphore->lock();
+  readySemaphore->lock ();
 
-  if(releasing)
+  if (releasing)
     return NULL;
 
-  readyMutex.lock();
+  readyMutex.lock ();
 
-  for(int i = 0; i < PRIORITY_CLASSES; i++)
-  {
-    if(currentPriorityDone > currentPriority ||
-       !ready[currentPriority].size())
+  for (int i = 0; i < PRIORITY_CLASSES; i++)
     {
-      currentPriority = (currentPriority + 1) % PRIORITY_CLASSES;
-      currentPriorityDone = 0;
+      if (currentPriorityDone > currentPriority ||
+          !ready[currentPriority].size())
+        {
+          currentPriority = (currentPriority + 1) % PRIORITY_CLASSES;
+          currentPriorityDone = 0;
+        }
+
+      if (ready[currentPriority].size ())
+        {
+          ret = ready[currentPriority].front ();
+          ret->setScheduled (0);
+          ready[currentPriority].pop ();
+          currentPriorityDone++;
+          break;
+        }
     }
 
-    if(ready[currentPriority].size())
-    {
-      ret = ready[currentPriority].front();
-      ret->setScheduled(0);
-      ready[currentPriority].pop();
-      currentPriorityDone++;
-      break;
-    }
-  }
-
-  readyMutex.unlock();
-
+  readyMutex.unlock ();
   return ret;
 }
 
 /*!
- *Release all the blocking calls.
+ * Release all the blocking calls.
  */
-void ConnectionsScheduler::release()
+void ConnectionsScheduler::release ()
 {
   u_long nbw;
   u_long max = 0;
@@ -470,146 +461,142 @@ void ConnectionsScheduler::release()
   dispatcherArg.terminate = true;
 
   if (server)
-    max = server->getNumThreads() * 2;
+    max = server->getNumThreads () * 2;
 
   for (u_long i = 0; i < max; i++)
-  {
-    readySemaphore->unlock();
-  }
+    {
+      readySemaphore->unlock ();
+    }
 
   Socket sockR (dispatcherArg.socketPair.getFirstHandle ());
   Socket sockW (dispatcherArg.socketPair.getSecondHandle ());
 
-  eventsSocketMutex.lock();
-  sockW.write("r", 1, &nbw);
-  eventsSocketMutex.unlock();
-  
-  if(dispatchedThreadId)
-    Thread::join(dispatchedThreadId);
+  eventsSocketMutex.lock ();
+  sockW.write ("r", 1, &nbw);
+  eventsSocketMutex.unlock ();
 
-  terminateConnections();
+  if (dispatchedThreadId)
+    Thread::join (dispatchedThreadId);
 
-  eventsMutex.lock();
+  terminateConnections ();
 
-  event_del(&(dispatcherArg.loopEvent));
+  eventsMutex.lock ();
 
-  list<ListenerArg*>::iterator it = listeners.begin();
+  event_del (&(dispatcherArg.loopEvent));
 
-  while(it != listeners.end())
-  {
-    event_del(&((*it)->ev));
-    delete (*it);
-    it++;
-  }
+  list<ListenerArg*>::iterator it = listeners.begin ();
 
-  listeners.clear();
-  
-  eventsMutex.unlock();
+  while (it != listeners.end ())
+    {
+      event_del (&((*it)->ev));
+      delete *it;
+      it++;
+    }
+
+  listeners.clear ();
+
+  eventsMutex.unlock ();
 
   dispatcherArg.socketPair.close ();
 }
 
 /*!
- *Fill a list with all the alive connections.
- *\param out A list that will receive all the connections alive on the
- *server.
+ * Fill a list with all the alive connections.
+ * \param out A list that will receive all the connections alive on the
+ * server.
  */
-void ConnectionsScheduler::getConnections(list<ConnectionPtr> &out)
+void ConnectionsScheduler::getConnections (list<ConnectionPtr> &out)
 {
-  out.clear();
+  out.clear ();
 
-  connectionsMutex.lock();
+  connectionsMutex.lock ();
 
-  HashMap<SocketHandle, ConnectionPtr>::Iterator it = connections.begin();
-  for(; it != connections.end(); it++)
-    out.push_back(*it);
+  HashMap<SocketHandle, ConnectionPtr>::Iterator it = connections.begin ();
+  for(; it != connections.end (); it++)
+    out.push_back (*it);
 
-  connectionsMutex.unlock();
+  connectionsMutex.unlock ();
 }
 
 /*!
- *Get the alive connections number.
+ * Get the alive connections number.
  */
-u_long ConnectionsScheduler::getConnectionsNumber()
+u_long ConnectionsScheduler::getConnectionsNumber ()
 {
-  return connections.size();
+  return connections.size ();
 }
 
 /*!
- *Remove a connection from the connections set.
+ * Remove a connection from the connections set.
  */
-void ConnectionsScheduler::removeConnection(ConnectionPtr connection)
+void ConnectionsScheduler::removeConnection (ConnectionPtr connection)
 {
-  connectionsMutex.lock();
-  if(connection->socket)
-    connections.remove((SocketHandle)connection->socket->getHandle());
-  connectionsMutex.unlock();
+  connectionsMutex.lock ();
+  if (connection->socket)
+    connections.remove ((SocketHandle)connection->socket->getHandle ());
+  connectionsMutex.unlock ();
 }
 
 /*!
- *Terminate any active connection.
+ * Terminate any active connection.
  */
-void ConnectionsScheduler::terminateConnections()
+void ConnectionsScheduler::terminateConnections ()
 {
   int i;
 
   try
-  {
-    connectionsMutex.lock();
-
-    HashMap<SocketHandle, ConnectionPtr>::Iterator it = connections.begin();
-    for(; it != connections.end(); it++)
     {
-      ConnectionPtr c = *it;
-      if (c->allowDelete(true) && c->socket)
-        c->socket->close();
+      connectionsMutex.lock();
+
+      HashMap<SocketHandle, ConnectionPtr>::Iterator it = connections.begin ();
+      for (; it != connections.end (); it++)
+        {
+          ConnectionPtr c = *it;
+          if (c->allowDelete (true) && c->socket)
+            c->socket->close ();
+        }
     }
-  }
-  catch(...)
-  {
-    connectionsMutex.unlock();
-    throw;
-  };
+  catch (...)
+    {
+      connectionsMutex.unlock ();
+      throw;
+    };
 
-  connections.clear();
+  connections.clear ();
 
-  connectionsMutex.unlock();
+  connectionsMutex.unlock ();
 
-  readyMutex.lock();
+  readyMutex.lock ();
 
-  for(i = 0; i < PRIORITY_CLASSES; i++)
-    while(ready[i].size())
-      ready[i].pop();
+  for (i = 0; i < PRIORITY_CLASSES; i++)
+    while (ready[i].size())
+      ready[i].pop ();
 
-  readyMutex.unlock();
+  readyMutex.unlock ();
 }
 
 /*!
- *Accept a visitor on the connections.
+ * Accept a visitor on the connections.
  */
-int ConnectionsScheduler::accept(ConnectionsSchedulerVisitor* visitor, void* 
args)
+int ConnectionsScheduler::accept (ConnectionsSchedulerVisitor* visitor, void* 
args)
 {
   int ret = 0;
-  connectionsMutex.lock();
+  connectionsMutex.lock ();
 
   try
-  {
+    {
 
-    for(HashMap<SocketHandle, ConnectionPtr>::Iterator it = 
connections.begin(); 
-        it != connections.end()  && !ret; 
-        it++)
+      for (HashMap<SocketHandle, ConnectionPtr>::Iterator it =
+             connections.begin (); it != connections.end()  && !ret; it++)
+        visitor->visitConnection(*it, args);
+    }
+  catch (...)
     {
-      visitor->visitConnection(*it, args);
+      connectionsMutex.unlock ();
+      return 1;
     }
-  }
-  catch(...)
-  {
-    connectionsMutex.unlock();
-    return 1;
-  }
 
-  connectionsMutex.unlock();
+  connectionsMutex.unlock ();
 
   return ret;
-
 }
diff --git a/myserver/src/connections_scheduler/listen_threads.cpp 
b/myserver/src/connections_scheduler/listen_threads.cpp
index 4198857..b81263e 100644
--- a/myserver/src/connections_scheduler/listen_threads.cpp
+++ b/myserver/src/connections_scheduler/listen_threads.cpp
@@ -23,22 +23,19 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 extern "C"
 {
 #ifdef WIN32
-  //#include <Ws2tcpip.h>
-#include <direct.h>
+# include <direct.h>
 #endif
 #ifndef WIN32
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#ifdef HAVE_PTHREAD
-#include <pthread.h>
-#endif
-
+# include <unistd.h>
+# include <string.h>
+# include <signal.h>
+# include <stdlib.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# ifdef HAVE_PTHREAD
+#  include <pthread.h>
+# endif
 #endif
 }
 
@@ -49,7 +46,7 @@ extern "C"
 using namespace std;
 
 /*!
- *c'tor.
+ * C'tor.
  */
 ListenThreads::ListenThreads(ConnectionsScheduler* scheduler, Server* server)
 {
@@ -60,24 +57,23 @@ ListenThreads::ListenThreads(ConnectionsScheduler* 
scheduler, Server* server)
 }
 
 /*!
- *This function is used to create a socket server and a thread listener
- *for a port.
+ * This function is used to create a socket server and a thread listener
+ * for a port.
  */
 int ListenThreads::createServerAndListener(u_short port)
 {
   int optvalReuseAddr = 1;
-  ostringstream portBuff;
   string listenPortMsg;
 
-  if(fastRebooting)
-  {
-    frPortsToAdd.push_back(port);
-    return 0;
-  }
+  if (fastRebooting)
+    {
+      frPortsToAdd.push_back (port);
+      return 0;
+    }
 
   /*
-   *Create the server sockets:
-   *one server socket for IPv4 and another one for IPv6
+   * Create the server sockets:
+   * one server socket for IPv4 and another one for IPv6
    */
   Socket *serverSocketIPv4 = new Socket();
   Socket *serverSocketIPv6 = NULL;
@@ -86,233 +82,211 @@ int ListenThreads::createServerAndListener(u_short port)
   si->port = port;
 
   /*
-   *Create the server socket.
+   * Create the server socket.
    */
   try
-  {
-    if ( serverSocketIPv4 != NULL )
     {
-      server->logWriteln(languageParser->getValue("MSG_SSOCKCREATE"));
-      serverSocketIPv4->socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-      if (serverSocketIPv4->getHandle() == (Handle)INVALID_SOCKET)
-      {
-        server->logWriteln(languageParser->getValue("ERR_OPENP"), 
MYSERVER_LOG_MSG_ERROR);
-        delete serverSocketIPv4;
-        serverSocketIPv4 = NULL;
-      }
-      else
-      {
-        MYSERVER_SOCKADDR_STORAGE sockServerSocketIPv4 = { 0 };
-        server->logWriteln(languageParser->getValue("MSG_SSOCKRUN"));
-        ((sockaddr_in*)(&sockServerSocketIPv4))->sin_family = AF_INET;
-        ((sockaddr_in*)(&sockServerSocketIPv4))->sin_addr.s_addr = 
-          htonl(INADDR_ANY);
-        ((sockaddr_in*)(&sockServerSocketIPv4))->sin_port =
-          htons((u_short)port);
+      if ( serverSocketIPv4 != NULL )
+        {
+          serverSocketIPv4->socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+          if (serverSocketIPv4->getHandle() == (Handle)INVALID_SOCKET)
+            {
+              server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                            _("Error while creating the server socket"));
+              delete serverSocketIPv4;
+              serverSocketIPv4 = NULL;
+            }
+          else
+            {
+              MYSERVER_SOCKADDR_STORAGE sockServerSocketIPv4 = { 0 };
+              ((sockaddr_in*)(&sockServerSocketIPv4))->sin_family = AF_INET;
+              ((sockaddr_in*)(&sockServerSocketIPv4))->sin_addr.s_addr =
+                htonl (INADDR_ANY);
+              ((sockaddr_in*)(&sockServerSocketIPv4))->sin_port =
+                htons ((u_short)port);
 
 #ifndef WIN32
-        /*
-         *Under the unix environment the application needs some time before
-         * create a new socket for the same address.
-         *To avoid this behavior we use the current code.
-         */
-        if(serverSocketIPv4->setsockopt(SOL_SOCKET, SO_REUSEADDR,
-                                        (const char *)&optvalReuseAddr,
-                                        sizeof(optvalReuseAddr)) < 0)
-        {
-          server->logWriteln(languageParser->getValue("ERR_ERROR"), 
MYSERVER_LOG_MSG_ERROR);
-          delete serverSocketIPv4;
-          serverSocketIPv4 = NULL;
-          //return 0; allow IPv6
-        }
+              if (serverSocketIPv4->setsockopt (SOL_SOCKET, SO_REUSEADDR,
+                                                (const char *)&optvalReuseAddr,
+                                                sizeof(optvalReuseAddr)) < 0)
+                {
+                  server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                                 _("Error while creating the server socket"));
+
+                  delete serverSocketIPv4;
+                  serverSocketIPv4 = NULL;
+                }
 #endif
-        if( serverSocketIPv4 != NULL )
+              if (serverSocketIPv4)
+                {
+                  server->logWriteln (MYSERVER_LOG_MSG_INFO,
+                                      _("Binding the port"));
+
+                  if (!serverSocketIPv4->bind (&sockServerSocketIPv4,
+                                              sizeof(sockaddr_in)))
+                    server->logWriteln (MYSERVER_LOG_MSG_INFO, _("Port was 
bound"));
+                  else
+                    {
+                      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                                          _("Error while creating the server 
socket"));
+                      delete serverSocketIPv4;
+                      serverSocketIPv4 = NULL;
+                    }
+
+                }
+            }
+        }
+
+#if HAVE_IPV6
+      serverSocketIPv6 = new Socket();
+
+      if (serverSocketIPv6 != NULL)
         {
-          /*
-           *Bind the port.
-           */
-          server->logWriteln(languageParser->getValue("MSG_BIND_PORT"));
-          
-          if (serverSocketIPv4->bind(&sockServerSocketIPv4,
-                                     sizeof(sockaddr_in)) != 0)
-          {
-            server->logWriteln(languageParser->getValue("ERR_BIND"), 
MYSERVER_LOG_MSG_ERROR);
-            delete serverSocketIPv4;
-            serverSocketIPv4 = NULL;
-          }
+          serverSocketIPv6->socket (AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+          if ( serverSocketIPv6->getHandle () == (FileHandle)INVALID_SOCKET)
+            {
+              server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                                 _("Error while creating the server socket"));
+              delete serverSocketIPv6;
+              serverSocketIPv6 = NULL;
+            }
           else
-            server->logWriteln(languageParser->getValue("MSG_PORT_BOUND"));
+            {
+              MYSERVER_SOCKADDR_STORAGE sockServerSocketIPv6 = { 0 };
+              ((sockaddr_in6*)(&sockServerSocketIPv6))->sin6_family = AF_INET6;
+              ((sockaddr_in6*)(&sockServerSocketIPv6))->sin6_addr = 
in6addr_any;
+              ((sockaddr_in6*)(&sockServerSocketIPv6))->sin6_port =
+                htons((u_short)port);
+# ifndef WIN32
+              if (serverSocketIPv6->setsockopt (SOL_SOCKET, SO_REUSEADDR,
+                                                (const char *)&optvalReuseAddr,
+                                                sizeof(optvalReuseAddr)) < 0)
+                {
+                  server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                                 _("Error while creating the server socket"));
+                  delete serverSocketIPv6;
+                  serverSocketIPv6 = NULL;
+                }
+
+              if(serverSocketIPv6->setsockopt (IPPROTO_IPV6, IPV6_V6ONLY,
+                                              (const char *)&optvalReuseAddr,
+                                              sizeof(optvalReuseAddr)) < 0)
+                {
+                  server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                                 _("Error while creating the server socket"));
+                  delete serverSocketIPv6;
+                  serverSocketIPv6 = NULL;
+                }
+# endif
+              if (serverSocketIPv6)
+                {
+                  server->logWriteln (MYSERVER_LOG_MSG_INFO,
+                                      _("Binding the port"));
+
+                  if (!serverSocketIPv6->bind (&sockServerSocketIPv6,
+                                               sizeof(sockaddr_in6)))
+                    server->logWriteln (MYSERVER_LOG_MSG_INFO,
+                                        _("Port was bound"));
+                  else
+                    {
+                      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                                 _("Error while creating the server socket"));
+                      delete serverSocketIPv6;
+                      serverSocketIPv6 = NULL;
+                    }
+                }
+            }
         }
-      }
-    }
+#endif // HAVE_IPV6
 
-#if ( HAVE_IPV6 )
-    serverSocketIPv6 = new Socket();
+      if (serverSocketIPv4 == NULL && serverSocketIPv6 == NULL)
+        {
+          delete si;
+          return 1;
+        }
 
-    if (serverSocketIPv6 != NULL)
-    {
-      server->logWriteln(languageParser->getValue("MSG_SSOCKCREATE"));
-      serverSocketIPv6->socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
-      if ( serverSocketIPv6->getHandle() == (FileHandle)INVALID_SOCKET )
-      {
-        server->logWriteln(languageParser->getValue("ERR_OPENP"), 
MYSERVER_LOG_MSG_ERROR);
-        delete serverSocketIPv6;
-        serverSocketIPv6 = NULL;
-      }
-      else
-      {
-        MYSERVER_SOCKADDR_STORAGE sockServerSocketIPv6 = { 0 };
-        server->logWriteln(languageParser->getValue("MSG_SSOCKRUN"));
-        ((sockaddr_in6*)(&sockServerSocketIPv6))->sin6_family = AF_INET6;
-        ((sockaddr_in6*)(&sockServerSocketIPv6))->sin6_addr = in6addr_any;
-        ((sockaddr_in6*)(&sockServerSocketIPv6))->sin6_port = 
-          htons((u_short)port);
-#ifndef WIN32
-        /*
-         *Under the unix environment the application needs some time before
-         * create a new socket for the same address.
-         *To avoid this behavior we use the current code.
-         */
-        if(serverSocketIPv6->setsockopt(SOL_SOCKET, SO_REUSEADDR,
-                                        (const char *)&optvalReuseAddr,
-                                        sizeof(optvalReuseAddr))<0)
+      if (serverSocketIPv4 != NULL && serverSocketIPv4->listen (SOMAXCONN))
         {
-          server->logWriteln(languageParser->getValue("ERR_ERROR"), 
MYSERVER_LOG_MSG_ERROR);
-          delete serverSocketIPv6;
-          serverSocketIPv6 = NULL;
-          //return 0;allow IPv6
+          server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                             _("Error while creating the server socket"));
+          delete serverSocketIPv4;
+          serverSocketIPv4 = NULL;
         }
 
-        if(serverSocketIPv6->setsockopt(IPPROTO_IPV6, IPV6_V6ONLY,
-                                        (const char *)&optvalReuseAddr,
-                                        sizeof(optvalReuseAddr)) < 0)
+      if (serverSocketIPv6 != NULL && serverSocketIPv6->listen (SOMAXCONN))
         {
-          server->logWriteln(languageParser->getValue("ERR_ERROR"), 
MYSERVER_LOG_MSG_ERROR);
+          server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                             _("Error while creating the server socket"));
           delete serverSocketIPv6;
           serverSocketIPv6 = NULL;
-          //return 0;allow IPv6
         }
-#endif
-        if(serverSocketIPv6 != NULL )
-        {
-          /*
-           *Bind the port.
-           */
-          server->logWriteln(languageParser->getValue("MSG_BIND_PORT"));
-          
-          if ( serverSocketIPv6->bind(&sockServerSocketIPv6,
-                                      sizeof(sockaddr_in6)) != 0)
-          {
-            server->logWriteln(languageParser->getValue("ERR_BIND"), 
MYSERVER_LOG_MSG_ERROR);
-            delete serverSocketIPv6;
-            serverSocketIPv6 = NULL;
-          }
-          else
-            server->logWriteln(languageParser->getValue("MSG_PORT_BOUND"));
 
+      if ( serverSocketIPv4 == NULL && serverSocketIPv6 == NULL )
+        {
+          delete si;
+          return 1;
         }
-      }
-    }
-#endif // HAVE_IPV6
-    
-    if ( serverSocketIPv4 == NULL && serverSocketIPv6 == NULL )
-    {
-      delete si;
-      return 1;
-    }
-
-    /*
-     *Set connections listen queque to max allowable.
-     */
-    server->logWriteln(languageParser->getValue("MSG_SLISTEN"));
-    if (serverSocketIPv4 != NULL && serverSocketIPv4->listen(SOMAXCONN))
-    {
-      server->logWriteln(languageParser->getValue("ERR_LISTEN"), 
MYSERVER_LOG_MSG_ERROR);
-      delete serverSocketIPv4;
-      serverSocketIPv4 = NULL;
-    }
 
-    if (serverSocketIPv6 != NULL && serverSocketIPv6->listen(SOMAXCONN))
-    {
-      server->logWriteln(languageParser->getValue("ERR_LISTEN"), 
MYSERVER_LOG_MSG_ERROR);
-      delete serverSocketIPv6;
-      serverSocketIPv6 = NULL;
-    }
-
-    if ( serverSocketIPv4 == NULL && serverSocketIPv6 == NULL )
-    {
-      delete si;
-      return 1;
-    }
+      server->logWriteln (MYSERVER_LOG_MSG_INFO,
+                          _("Listening on the port: %i"), port);
 
-    portBuff << (u_int)port;
+      si->ipv4 = serverSocketIPv4;
+      si->ipv6 = serverSocketIPv6;
 
-    listenPortMsg.assign(languageParser->getValue("MSG_LISTEN"));
-    listenPortMsg.append(": ");
-    listenPortMsg.append(portBuff.str());
-  
-    server->logWriteln(listenPortMsg.c_str());
+      usedPorts.put (port, si);
 
-    si->ipv4 = serverSocketIPv4;
-    si->ipv6 = serverSocketIPv6;
+      registerListener (si);
 
-    usedPorts.put(port, si);
-    
-    registerListener(si);
-
-    return 0;
-  }
+      return 0;
+    }
   catch( bad_alloc &ba)
-  {
-    ostringstream s;
-    s << "Error: Bad allocation " << ba.what();
-    server->logWriteln(s.str().c_str());
-  }
+    {
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR, _("Bad alloc: %s"),
+                          ba.what ());
+    }
   catch( exception &e)
-  {
-    ostringstream s;
-    s << "Error :" << e.what();
-    server->logWriteln(s.str().c_str());
-  };
+    {
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error: %s"),
+                          e.what ());
+    };
   return 1;
 }
 
 /*!
- *Register the sockets on the events listener.
+ * Register the sockets on the events listener.
  */
-void ListenThreads::registerListener(SocketInformation* si)
+void ListenThreads::registerListener (SocketInformation* si)
 {
-
-    if(si->ipv4)
+  if (si->ipv4)
     {
-      si->laIpv4.reset(si->ipv4, si->port, server);
-      scheduler->listener(&(si->laIpv4));
+      si->laIpv4.reset (si->ipv4, si->port, server);
+      scheduler->listener (&(si->laIpv4));
     }
 
-    if(si->ipv6)
-    {
-      si->laIpv6.reset(si->ipv6, si->port, server);
-      scheduler->listener(&(si->laIpv6));
-    }
+    if (si->ipv6)
+      {
+        si->laIpv6.reset (si->ipv6, si->port, server);
+        scheduler->listener (&(si->laIpv6));
+      }
 }
 
 /*!
- *Add a listening thread on a specific port.
- *\param port Port to listen on.
+ * Add a listening thread on a specific port.
+ * \param port Port to listen on.
  */
-void ListenThreads::addListeningThread(u_short port)
+void ListenThreads::addListeningThread (u_short port)
 {
-  if(!(fastRebooting || committingFastReboot))
-    if(usedPorts.get(port))
+  if (!(fastRebooting || committingFastReboot))
+    if (usedPorts.get (port))
       return;
-  createServerAndListener(port);
+  createServerAndListener (port);
 }
 
 /*!
- *Initialize the listen threads manager.
- *\param parser Xml data to use for error messages.
+ * Initialize the listen threads manager.
+ * \param parser Xml data to use for error messages.
  */
-int ListenThreads::initialize(XmlParser* parser)
+int ListenThreads::initialize (XmlParser* parser)
 {
   languageParser = parser;
   shutdownStatus = false;
@@ -320,9 +294,9 @@ int ListenThreads::initialize(XmlParser* parser)
 }
 
 /*!
- *Complete the fast reboot.
+ * Complete the fast reboot.
  */
-void ListenThreads::commitFastReboot()
+void ListenThreads::commitFastReboot ()
 {
   /* Contains already present ports.  */
   set<u_short> presentPorts;
@@ -342,94 +316,88 @@ void ListenThreads::commitFastReboot()
   fastRebooting = false;
   committingFastReboot = true;
 
-  for(HashMap<u_short, SocketInformation*>::Iterator it = usedPorts.begin(); 
-      it != usedPorts.end(); it++)
-  {
-    presentPorts.insert((*it)->port);
-  }
+  for (HashMap<u_short, SocketInformation*>::Iterator it = usedPorts.begin ();
+      it != usedPorts.end (); it++)
+    presentPorts.insert ((*it)->port);
 
-  for(list<u_short>::iterator it = frPortsToAdd.begin(); it != 
frPortsToAdd.end(); it++)
-  {
-    newPorts.insert(*it);
-  }
+  for(list<u_short>::iterator it = frPortsToAdd.begin ();
+      it != frPortsToAdd.end (); it++)
+    newPorts.insert (*it);
 
-  /* intersection = intersection(presentsPorts, newPorts).  */
-  set_intersection(presentPorts.begin(), presentPorts.end(), newPorts.begin(), 
newPorts.end(),
-                   insert_iterator<set<u_short> >(intersection, 
intersection.begin()));
+  /* intersection = intersection (presentsPorts, newPorts).  */
+  set_intersection (presentPorts.begin (), presentPorts.end (),
+                    newPorts.begin (), newPorts.end (),
+                    insert_iterator<set<u_short> >(intersection,
+                                                   intersection.begin ()));
 
 
   /* toRemove = presentsPorts - newPorts.  */
-  set_difference(presentPorts.begin(), presentPorts.end(), newPorts.begin(), 
newPorts.end(),
-                 insert_iterator<set<u_short> >(toRemove, toRemove.begin()));
+  set_difference (presentPorts.begin (), presentPorts.end (),
+                  newPorts.begin (), newPorts.end (),
+                  insert_iterator<set<u_short> >(toRemove, toRemove.begin ()));
 
 
   /* toAdd = newPorts - presentsPorts.  */
-  set_difference(newPorts.begin(), newPorts.end(), presentPorts.begin(), 
presentPorts.end(),
-                 insert_iterator<set<u_short> >(toAdd, toAdd.begin()));
+  set_difference (newPorts.begin (), newPorts.end (), presentPorts.begin (),
+    presentPorts.end (), insert_iterator<set<u_short> >(toAdd, toAdd.begin 
()));
 
 
 
   /* Ports in intersections need only to be registered on the event listener.  
*/
-  for(set<u_short>::iterator it = intersection.begin(); it != 
intersection.end(); it++)
-  {
-    registerListener(usedPorts.get(*it));
-  }
+  for (set<u_short>::iterator it = intersection.begin ();
+       it != intersection.end (); it++)
+    registerListener (usedPorts.get (*it));
 
   /* Create here the new ports.  */
-  for(set<u_short>::iterator it = toAdd.begin(); it != toAdd.end(); it++)
-   {
-    createServerAndListener(*it);
-  }
+  for (set<u_short>::iterator it = toAdd.begin (); it != toAdd.end (); it++)
+    createServerAndListener (*it);
 
   /* Enqueue connections to remove to frPortsToRemove and destroy them with 
terminate.  */
-  for(set<u_short>::iterator it = toRemove.begin(); it != toRemove.end(); it++)
-  {
-    SocketInformation* si;
-    si = usedPorts.get(*it);
-    frPortsToRemove.push_back(si);
-    usedPorts.remove(si->port);
-  }
+  for (set<u_short>::iterator it = toRemove.begin (); it != toRemove.end (); 
it++)
+    {
+      SocketInformation* si;
+      si = usedPorts.get (*it);
+      frPortsToRemove.push_back (si);
+      usedPorts.remove (si->port);
+    }
 
-  terminate();
+  terminate ();
 
-  frPortsToAdd.clear();
-  frPortsToRemove.clear();
+  frPortsToAdd.clear ();
+  frPortsToRemove.clear ();
 
   committingFastReboot = false;
 }
 
 
 /*!
- *Restore the previous situation without do anything.
+ * Restore the previous situation without do anything.
  */
-void ListenThreads::rollbackFastReboot()
+void ListenThreads::rollbackFastReboot ()
 {
   fastRebooting = false;
   committingFastReboot = false;
-  
-  for(HashMap<u_short, SocketInformation*>::Iterator it = usedPorts.begin(); 
-      it != usedPorts.end(); it++)
-  {
-    registerListener(*it);
-  }
-
-  frPortsToAdd.clear();
-  frPortsToRemove.clear();
+
+  for (HashMap<u_short, SocketInformation*>::Iterator it = usedPorts.begin ();
+      it != usedPorts.end (); it++)
+    registerListener (*it);
+
+  frPortsToAdd.clear ();
+  frPortsToRemove.clear ();
 }
 
 /*!
- *Prepare the listen threads manager for a fast reboot.
+ * Prepare the listen threads manager for a fast reboot.
  */
-void ListenThreads::beginFastReboot()
+void ListenThreads::beginFastReboot ()
 {
   fastRebooting = true;
 }
 
-
 /*!
- *Unload the listen threads manager.
+ * Unload the listen threads manager.
  */
-int ListenThreads::terminate()
+int ListenThreads::terminate ()
 {
   char buffer[256];
 
@@ -438,59 +406,54 @@ int ListenThreads::terminate()
   list <SocketInformation*>::iterator it;
   list <SocketInformation*>::iterator end;
 
-  if(fastRebooting)
-  {
+  if (fastRebooting)
     return 0;
-  }
-  else if(committingFastReboot)
-  {
-    it = frPortsToRemove.begin();
-    end = frPortsToRemove.end();
-  }
+  else if (committingFastReboot)
+    {
+      it = frPortsToRemove.begin ();
+      end = frPortsToRemove.end ();
+    }
   else
-  {
-    for(HashMap<u_short, SocketInformation*>::Iterator i = usedPorts.begin(); 
-        i != usedPorts.end(); i++)
-      sockets.push_front(*i);
+    {
+      for (HashMap<u_short, SocketInformation*>::Iterator i = 
usedPorts.begin();
+           i != usedPorts.end (); i++)
+      sockets.push_front (*i);
+      it = sockets.begin ();
+      end = sockets.end ();
+      shutdown ();
+    }
 
-    it = sockets.begin();
-    end = sockets.end();
+  while (it != end)
+    {
+      for (int t = 0; t < 2; t++)
+        {
+          Socket* serverSocket;
+          int err;
 
-    shutdown();
-  }
+          if (t == 0)
+            serverSocket = (*it)->ipv4;
+          else
+            serverSocket = (*it)->ipv6;
 
-  while(it != end)
-  {
-    for(int t = 0; t < 2; t++)
-    {
-      Socket* serverSocket;
-      int err;
-
-      if(t == 0)
-        serverSocket = (*it)->ipv4;
-      else
-        serverSocket = (*it)->ipv6;
-      
-      if(!serverSocket)
-        continue;
-
-      serverSocket->shutdown(SD_BOTH);
-      do
-      {
-        err = serverSocket->recv(buffer, 256, 0);
-      }while(err != -1);
+          if (!serverSocket)
+            continue;
+
+          serverSocket->shutdown (SD_BOTH);
+          do
+            {
+              err = serverSocket->recv (buffer, 256, 0);
+            }while (err != -1);
 
-      serverSocket->close();
-      delete serverSocket;
+          serverSocket->close ();
+          delete serverSocket;
+        }
+      delete (*it);
+      it++;
     }
-    delete (*it);
-    it++;
-  }
 
   /* If it is not a fast reboot then clear everything.  */
-  if(!(fastRebooting || committingFastReboot))
-  {
-    usedPorts.clear();
-  }
+  if (!(fastRebooting || committingFastReboot))
+    usedPorts.clear ();
+
   return 0;
 }
diff --git a/myserver/src/plugin/plugins_manager.cpp 
b/myserver/src/plugin/plugins_manager.cpp
index 7e238bb..632364d 100755
--- a/myserver/src/plugin/plugins_manager.cpp
+++ b/myserver/src/plugin/plugins_manager.cpp
@@ -36,18 +36,18 @@ extern "C"
 using namespace std;
 
 /*!
- *Default constructor.
+ * Default constructor.
  */
 PluginsManager::PluginsManager () { }
 
 /*!
- *Destroy the object.
+ * Destroy the object.
  */
 PluginsManager::~PluginsManager () { }
 
 /*!
- *Get a plugin trough  its name plugin.
- *\param name The plugin name.
+ * Get a plugin trough  its name plugin.
+ * \param name The plugin name.
  */
 Plugin*
 PluginsManager::getPlugin (string& name)
@@ -59,9 +59,8 @@ PluginsManager::getPlugin (string& name)
 }
 
 /*!
- *Load the plugin options.
- *\param server The server object to use.
- *messages.
+ * Load the plugin options.
+ * \param server The server object to use.
  */
 int
 PluginsManager::loadOptions (Server *server)
@@ -111,9 +110,8 @@ PluginsManager::loadOptions (Server *server)
         addPluginInfo (plugin, new PluginInfo (plugin, enabled, global));
       else
         {
-          string error;
-          error.assign ("Invalid plugin name in PLUGIN block.");
-          server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_WARNING);
+          server->logWriteln (MYSERVER_LOG_MSG_WARNING,
+                              _("Invalid plugin name in PLUGIN block."));
           ret = -1;
         }
     }
@@ -122,13 +120,12 @@ PluginsManager::loadOptions (Server *server)
 }
 
 /*!
- *Preload sequence, called when all the plugins are not yet loaded.
- *\param server The server object to use.
- *implementation it is a directory name.
+ * Preload sequence, called when all the plugins are not yet loaded.
+ * \param server The server object to use.
+ * implementation it is a directory name.
  */
 int
-PluginsManager::preLoad (Server* server,
-                         string& resource)
+PluginsManager::preLoad (Server* server, string& resource)
 {
   FindData fdir;
   FindData flib;
@@ -146,7 +143,8 @@ PluginsManager::preLoad (Server* server,
 
   if (ret == -1)
     {
-      server->logWriteln ("Invalid plugins source.", MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Invalid plugins source"));
       return ret;
     }
 
@@ -210,15 +208,13 @@ PluginsManager::preLoad (Server* server,
 #endif
           if (pinfo->isEnabled ())
             {
-              Plugin* plugin = preLoadPlugin (libname, server, pinfo->isGlobal 
());
+              Plugin* plugin = preLoadPlugin (libname, server,
+                                              pinfo->isGlobal ());
               if (!plugin)
                 {
                   ret |= 1;
-                  string error;
-                  error.append ("Unable to enable plugin ");
-                  error.append (name);
-                  error.append (".");
-                  server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+                  server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                                   _("Error loading plugin %s"), name.c_str 
());
                 }
               else
                 pinfo->setPlugin (plugin);
@@ -264,11 +260,8 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
 
   if (xml.open (path, true))
     {
-      string error;
-      error.append ("Unable to load plugin ");
-      error.append (name);
-      error.append (" info.");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error loading plugin %s"), name.c_str ());
       return NULL;
     }
 
@@ -281,11 +274,9 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
 
   if (size != 1)
     {
-      string error;
-      error.append ("Unable to load plugin ");
-      error.append (name);
-      error.append (", bad plugin.xml format.");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       return NULL;
     }
 
@@ -300,11 +291,9 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
     }
   else
     {
-      string error;
-      error.append ("Unable to load plugin ");
-      error.append (name);
-      error.append (", bad plugin.xml format.");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       return NULL;
     }
 
@@ -321,11 +310,9 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
     }
   else
     {
-      string error;
-      error.append ("Unable to load plugin ");
-      error.append (name);
-      error.append (", bad plugin.xml format.");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       delete xpathRes;
       return NULL;
     }
@@ -338,11 +325,9 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
 
   if (size != 1)
     {
-      string error;
-      error.append ("Unable to load plugin ");
-      error.append (name);
-      error.append (", bad plugin.xml format.");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       delete xpathRes;
       return NULL;
     }
@@ -364,27 +349,23 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
 
   if (size != 1)
     {
-      string error;
-      error.append ("Unable to load plugin ");
-      error.append (name);
-      error.append (", bad plugin.xml format.");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       delete xpathRes;
       return NULL;
     }
 
+  string verStr((char*) nodes->nodeTab[0]->content);
+  int version = PluginInfo::convertVersion (&verStr);
 
-  int version = PluginInfo::convertVersion (new string ((char*) 
nodes->nodeTab[0]->content));
-
-  if (version!=-1)
+  if (version != -1)
     pinfo->setVersion (version);
   else
     {
-      string error;
-      error.append ("Unable to load plugin ");
-      error.append (name);
-      error.append (", bad plugin.xml format.");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       delete xpathRes;
       return NULL;
     }
@@ -405,27 +386,26 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
       if (!xmlHasProp (nodes->nodeTab[i], (const xmlChar*) "min-version") ||
           !xmlHasProp (nodes->nodeTab[i], (const xmlChar*) "max-version"))
         {
-          string error;
-          error.append ("Unable to load plugin ");
-          error.append (name);
-          error.append (", bad plugin.xml format.");
-          server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+          server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                              _("Error loading plugin %s, invalid plugin.xml"),
+                              name.c_str ());
+          delete xpathRes;
           return NULL;
         }
 
-      int minVersion = PluginInfo::convertVersion (new string ((char*) 
xmlGetProp (nodes->nodeTab[i],
-                                                                               
    (const xmlChar*) "min-version")));
+      string minVerStr = ((char*) xmlGetProp (nodes->nodeTab[i],
+                                              (const xmlChar*) "min-version"));
+      string maxVerStr = ((char*) xmlGetProp (nodes->nodeTab[i],
+                                              (const xmlChar*) "max-version"));
 
-      int maxVersion = PluginInfo::convertVersion (new string ((char*) 
xmlGetProp (nodes->nodeTab[i],
-                                                                               
    (const xmlChar*) "max-version")));
+      int minVersion = PluginInfo::convertVersion (&minVerStr);
+      int maxVersion = PluginInfo::convertVersion (&maxVerStr);
 
       if (minVersion == -1 || maxVersion == -1)
         {
-          string error;
-          error.append ("Unable to load plugin ");
-          error.append (name);
-          error.append (", bad plugin.xml format.");
-          server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+          server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                              _("Error loading plugin %s, invalid plugin.xml"),
+                              name.c_str ());
           delete xpathRes;
           return NULL;
         }
@@ -439,12 +419,12 @@ PluginsManager::loadInfo (Server* server, string& name, 
string& path)
 }
 
 /*!
- *Add a plugin.
- *\param file The plugin file name.
- *\param server The server object to use.
- *\param languageFile The language file to use to retrieve warnings/errors 
- *messages.
- *\param global Specify if the library should be loaded globally.
+ * Add a plugin.
+ * \param file The plugin file name.
+ * \param server The server object to use.
+ * \param languageFile The language file to use to retrieve warnings/errors
+ * messages.
+ * \param global Specify if the library should be loaded globally.
  */
 Plugin*
 PluginsManager::preLoadPlugin (string& file, Server* server, bool global)
@@ -456,11 +436,9 @@ PluginsManager::preLoadPlugin (string& file, Server* 
server, bool global)
 
   if (plugin->preLoad (file, global))
     {
-      string error;
-      error.append ("Unable to pre-load plugin ");
-      error.append (name);
-      error.append (".");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error pre-loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       delete plugin;
       return NULL;
     }
@@ -470,11 +448,9 @@ PluginsManager::preLoadPlugin (string& file, Server* 
server, bool global)
     name.assign (namePtr);
   else
     {
-      string error;
-      error.append ("Unable to pre-load plugin ");
-      error.append (name);
-      error.append (".");
-      server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+      server->logWriteln (MYSERVER_LOG_MSG_ERROR,
+                          _("Error pre-loading plugin %s, invalid plugin.xml"),
+                          name.c_str ());
       delete plugin;
       return NULL;
     }
@@ -483,7 +459,9 @@ PluginsManager::preLoadPlugin (string& file, Server* 
server, bool global)
 }
 
 void
-PluginsManager::recursiveDependencesFallDown (Server* server, string &name, 
HashMap<string, bool> &remove, HashMap<string, list<string>*> &dependsOn)
+PluginsManager::recursiveDependencesFallDown (Server* server, string &name,
+                                  HashMap<string, bool> &remove,
+                                  HashMap<string, list<string>*> &dependsOn)
 {
   remove.put (name, true);
   list<string>* dependsList = dependsOn.get (name);
@@ -494,21 +472,18 @@ PluginsManager::recursiveDependencesFallDown (Server* 
server, string &name, Hash
 
   for (; lit != dependsList->end (); lit++)
     {
-
-      string logBuf;
-      logBuf.append ("Missing plugin dependence: ");
-      logBuf.append (*lit);
-      logBuf.append (" --> ");
-      logBuf.append (name);
       recursiveDependencesFallDown (server, *lit, remove, dependsOn);
-      server->logWriteln (logBuf.c_str (), MYSERVER_LOG_MSG_WARNING);
+
+      server->logWriteln (MYSERVER_LOG_MSG_WARNING,
+                          _("Missing plugin dependence %s --> %s"),
+                          name.c_str (), (*lit).c_str ());
     }
 
 }
 
 /*!
- *Load the plugins.
- *\param server The server object to use.
+ * Load the plugins.
+ * \param server The server object to use.
  */
 int
 PluginsManager::load (Server *server)
@@ -521,14 +496,8 @@ PluginsManager::load (Server *server)
   HashMap<string, bool> remove;
   while (it != pluginsInfos.end ())
     {
-
-
       string name (it.getKey ());
-
-
       PluginInfo* pinfo = *it;
-
-
       HashMap<string, pair<int, int>* >::Iterator depIt = pinfo->begin ();
 
       string msversion (MYSERVER_VERSION);
@@ -537,17 +506,14 @@ PluginsManager::load (Server *server)
         msversion = msversion.substr (0, i);
 
       int msVersion = PluginInfo::convertVersion (&msversion);
-      if (msVersion < pinfo->getMyServerMinVersion () || msVersion > 
pinfo->getMyServerMaxVersion ())
-        {
-          string logBuf;
-          logBuf.append ("Plugin ");
-          logBuf.append (name);
-          logBuf.append (" not compatible with this myserver version! ");
-          server->logWriteln (logBuf.c_str (), MYSERVER_LOG_MSG_WARNING);
-          toRemove.push_front (&name);
-        }
+      if (msVersion < pinfo->getMyServerMinVersion ()
+          || msVersion > pinfo->getMyServerMaxVersion ())
+        server->logWriteln (MYSERVER_LOG_MSG_WARNING,
+                            _("Plugin %s not compatible with this version"),
+                            name.c_str ());
       else
         remove.put (name, false);
+
       for (; depIt != pinfo->end (); depIt++)
         {
           string dname = depIt.getKey ();
@@ -604,25 +570,22 @@ PluginsManager::load (Server *server)
           PluginInfo* dep = getPluginInfo (depN);
           if (!dep || remove.get (depN))
             {
-              logBuf.append ("Missing plugin dependence: ");
-              logBuf.append (dname);
-              logBuf.append (" --> ");
-              logBuf.append (depN);
+              server->logWriteln (MYSERVER_LOG_MSG_WARNING,
+                                  _("Missing plugin dependence %s --> %s"),
+                                  dname.c_str (), depN.c_str ());
               recursiveDependencesFallDown (server, dname, remove, dependsOn);
-              server->logWriteln (logBuf.c_str (), MYSERVER_LOG_MSG_WARNING);
               break;
             }
 
 
           pair<int, int>* pdep = *lit;
-          if (dep->getVersion () < pdep->first || dep->getVersion () > 
pdep->second)
+          if (dep->getVersion () < pdep->first
+              || dep->getVersion () > pdep->second)
             {
-              logBuf.append ("Plugin version not compatible: ");
-              logBuf.append (dname);
-              logBuf.append (" --> ");
-              logBuf.append (depN);
               recursiveDependencesFallDown (server, dname, remove, dependsOn);
-              server->logWriteln (logBuf.c_str (), MYSERVER_LOG_MSG_WARNING);
+              server->logWriteln (MYSERVER_LOG_MSG_WARNING,
+                            _("Plugin %s not compatible with this version"),
+                            dname.c_str ());
               break;
             }
         }
@@ -641,10 +604,10 @@ PluginsManager::load (Server *server)
 }
 
 /*!
- *PostLoad functions, called once all the plugins are loaded.
- *\param server The server object to use.
- *\param languageFile The language file to use to get errors and warnings 
- *messages.
+ * PostLoad functions, called once all the plugins are loaded.
+ * \param server The server object to use.
+ * \param languageFile The language file to use to get errors and warnings
+ * messages.
  */
 int
 PluginsManager::postLoad (Server *server, XmlParser* languageFile)
@@ -656,11 +619,9 @@ PluginsManager::postLoad (Server *server, XmlParser* 
languageFile)
       if (plugin)
         {
           plugin->postLoad (server, languageFile);
-          string logBuf;
-          logBuf.append ("Plugin ");
-          logBuf.append ((*it)->getName ());
-          logBuf.append (" loaded! ");
-          server->logWriteln (logBuf.c_str (), MYSERVER_LOG_MSG_INFO);
+          server->logWriteln (MYSERVER_LOG_MSG_INFO,
+                              _("Plugin %s loaded"),
+                              (*it)->getName ().c_str ());
         }
       it++;
     }
@@ -668,8 +629,8 @@ PluginsManager::postLoad (Server *server, XmlParser* 
languageFile)
 }
 
 /*!
- *Unload the plugins.
- *messages.
+ * Unload the plugins.
+ * messages.
  */
 int
 PluginsManager::unLoad ()
@@ -688,8 +649,8 @@ PluginsManager::unLoad ()
 }
 
 /*!
- *Remove a plugin  without clean it.
- *\param name The plugin to remove.
+ * Remove a plugin  without clean it.
+ * \param name The plugin to remove.
  */
 void
 PluginsManager::removePlugin (string& name)
@@ -700,9 +661,9 @@ PluginsManager::removePlugin (string& name)
 }
 
 /*!
- *Add a plugin option structure.
- *\param plugin The plugin name.
- *\param pi The options for the plugin.
+ * Add a plugin option structure.
+ * \param plugin The plugin name.
+ * \param pi The options for the plugin.
  */
 int
 PluginsManager::addPluginInfo (string& plugin, PluginInfo* pi)
@@ -716,8 +677,8 @@ PluginsManager::addPluginInfo (string& plugin, PluginInfo* 
pi)
 }
 
 /*!
- *Return a pluginOption.
- *\param plugin The plugin name.
+ * Return a pluginOption.
+ * \param plugin The plugin name.
  */
 PluginInfo*
 PluginsManager::getPluginInfo (string& plugin)
diff --git a/myserver/src/server/clients_thread.cpp 
b/myserver/src/server/clients_thread.cpp
index e32fb3b..0629f37 100644
--- a/myserver/src/server/clients_thread.cpp
+++ b/myserver/src/server/clients_thread.cpp
@@ -6,7 +6,7 @@ it under the terms of the GNU General Public License as 
published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
-This program is distributed in the hope that it will be useful, 
+This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
@@ -30,7 +30,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/protocol/ftp/ftp.h>
 
 #ifndef WIN32
-extern "C" 
+extern "C"
 {
 # include <sys/socket.h>
 # include <netinet/in.h>
@@ -48,7 +48,7 @@ extern "C"
 #endif
 
 /*!
- *Construct the object.
+ * Construct the object.
  */
 ClientsThread::ClientsThread (Server* server)
 {
@@ -92,7 +92,7 @@ ClientsThread::~ClientsThread()
 }
 
 /*!
- *Get the timeout value.
+ * Get the timeout value.
  */
 int ClientsThread::getTimeout ()
 {
@@ -100,8 +100,8 @@ int ClientsThread::getTimeout ()
 }
 
 /*!
- *Set the timeout value for the thread.
- *\param newTimeout The new timeout value.
+ * Set the timeout value for the thread.
+ * \param newTimeout The new timeout value.
  */
 void ClientsThread::setTimeout (int newTimeout)
 {
@@ -109,9 +109,9 @@ void ClientsThread::setTimeout (int newTimeout)
 }
 
 /*!
- *This function starts a new thread controlled by a ClientsThread 
- *class instance.
- *\param pParam Params to pass to the new thread.
+ * This function starts a new thread controlled by a ClientsThread
+ * class instance.
+ * \param pParam Params to pass to the new thread.
  */
 DEFINE_THREAD(clients_thread, pParam)
 {
@@ -139,7 +139,7 @@ DEFINE_THREAD(clients_thread, pParam)
   ct->threadIsStopped = false;
   ct->buffersize = ct->server->getBuffersize ();
   ct->secondaryBufferSize = ct->server->getBuffersize2 ();
-  
+
   ct->buffer.setLength (ct->buffersize);
   ct->buffer.m_nSizeLimit = ct->buffersize;
   ct->secondaryBuffer.setLength (ct->secondaryBufferSize);
@@ -184,16 +184,13 @@ DEFINE_THREAD(clients_thread, pParam)
         }
       catch (bad_alloc &ba)
         {
-          ostringstream s;
-          s << "Bad alloc: " << ba.what();
-
-          ct->server->logWriteln  (s.str ().c_str (), MYSERVER_LOG_MSG_ERROR);
+          ct->server->logWriteln (MYSERVER_LOG_MSG_ERROR, _("Bad alloc: %s"),
+                                  ba.what ());
         }
       catch (exception &e)
         {
-          ostringstream s;
-          s << "Error: " << e.what ();
-          ct->server->logWriteln (s.str ().c_str (), MYSERVER_LOG_MSG_ERROR);
+          ct->server->logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error : %s"),
+                                  e.what ());
         };
   }
 
@@ -205,8 +202,7 @@ DEFINE_THREAD(clients_thread, pParam)
 }
 
 /*!
- *Join the thread.
- *
+ * Join the thread.
  */
 int ClientsThread::join ()
 {
@@ -215,7 +211,7 @@ int ClientsThread::join ()
 
 
 /*!
- *Create the new thread.
+ * Create the new thread.
  */
 int ClientsThread::run ()
 {
@@ -225,7 +221,7 @@ int ClientsThread::run ()
 }
 
 /*!
- *Returns if the thread can be destroyed.
+ * Returns if the thread can be destroyed.
  */
 bool ClientsThread::isToDestroy()
 {
@@ -233,7 +229,7 @@ bool ClientsThread::isToDestroy()
 }
 
 /*!
- *Check if the thread is a static one.
+ * Check if the thread is a static one.
  */
 bool ClientsThread::isStatic()
 {
@@ -241,8 +237,8 @@ bool ClientsThread::isStatic()
 }
 
 /*!
- *Set the thread to be static.
- *\param value The new static value.
+ * Set the thread to be static.
+ * \param value The new static value.
  */
 void ClientsThread::setStatic (bool value)
 {
@@ -250,8 +246,8 @@ void ClientsThread::setStatic (bool value)
 }
 
 /*!
- *Set if the thread can be destroyed.
- *\param value The new destroy value.
+ * Set if the thread can be destroyed.
+ * \param value The new destroy value.
  */
 void ClientsThread::setToDestroy(bool value)
 {
@@ -259,18 +255,16 @@ void ClientsThread::setToDestroy(bool value)
 }
 
 /*!
- *This is the main loop of the thread.
- *Here are controlled all the connections that belongs to the 
- *ClientsThread class instance.
- *Every connection is controlled by its protocol.
- *Return 1 if no connections to serve are available.
- *Return 0 in all other cases.
+ * This is the main loop of the thread.
+ * Here are controlled all the connections that belongs to the
+ * ClientsThread class instance.
+ * Every connection is controlled by its protocol.
+ *\return 1 if no connections to serve are available.
+ *\return 0 in all other cases.
  */
 int ClientsThread::controlConnections ()
 {
-  /*
-   *Control the protocol used by the connection.
-   */
+  /* Control the protocol used by the connection.  */
   int retcode = 0;
   int err = 0;
   ConnectionPtr c;
@@ -281,9 +275,6 @@ int ClientsThread::controlConnections ()
 
   server->decreaseFreeThread ();
 
-  /*
-   *Check if c is a valid connection structure.
-   */
   if (!c)
     return 1;
 
@@ -322,10 +313,10 @@ int ClientsThread::controlConnections ()
   {
     if (c->hasContinuation ())
       {
-        retcode = c->getContinuation ()(c, (char*)buffer.getBuffer(), 
-                                   (char*)secondaryBuffer.getBuffer(), 
-                                   buffer.getRealLength(), 
-                                   secondaryBuffer.getRealLength(), 
+        retcode = c->getContinuation ()(c, (char*)buffer.getBuffer(),
+                                   (char*)secondaryBuffer.getBuffer(),
+                                   buffer.getRealLength(),
+                                   secondaryBuffer.getRealLength(),
                                    nBytesToRead, id);
         c->setContinuation (NULL);
       }
@@ -333,13 +324,11 @@ int ClientsThread::controlConnections ()
       {
         protocol = server->getProtocol (c->host->getProtocolName ());
         if (protocol)
-          {
-            retcode = protocol->controlConnection (c, 
(char*)buffer.getBuffer(),
-                                             
(char*)secondaryBuffer.getBuffer(), 
-                                              buffer.getRealLength(), 
-                                             secondaryBuffer.getRealLength(), 
-                                             nBytesToRead, id);
-          }
+          retcode = protocol->controlConnection (c, (char*)buffer.getBuffer(),
+                                           (char*)secondaryBuffer.getBuffer(),
+                                           buffer.getRealLength(),
+                                           secondaryBuffer.getRealLength(),
+                                           nBytesToRead, id);
         else
           retcode = DELETE_CONNECTION;
       }
@@ -367,9 +356,9 @@ int ClientsThread::controlConnections ()
   else if (retcode == INCOMPLETE_REQUEST)
     {
       /*
-       *If the header is incomplete save the current received
-       *data in the connection buffer.
-       *Save the header in the connection buffer.
+       * If the header is incomplete save the current received
+       * data in the connection buffer.
+       * Save the header in the connection buffer.
        */
       c->getConnectionBuffer ()->setBuffer (buffer.getBuffer (), nBytesToRead);
       server->getConnectionsScheduler ()->addWaitingConnection (c);

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

Summary of changes:
 .../connections_scheduler.cpp                      |  489 ++++++++---------
 .../src/connections_scheduler/listen_threads.cpp   |  569 +++++++++-----------
 myserver/src/plugin/plugins_manager.cpp            |  249 ++++-----
 myserver/src/server/clients_thread.cpp             |   93 ++--
 4 files changed, 650 insertions(+), 750 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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