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. 70c279cbf4


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 70c279cbf4b71bd0931a1e438c38cf65aee31ee7
Date: Tue, 04 Aug 2009 20:09:00 +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  70c279cbf4b71bd0931a1e438c38cf65aee31ee7 (commit)
       via  14c1af986336bf420b2c3f65e44b30017145561e (commit)
       via  22db7d21bcb370b861af4c36d5ad80340177ab6f (commit)
       via  d442a438e1402ce99796e231a0b3f90e258df628 (commit)
      from  582ef5270d7e583a725575cd15f570cd64662610 (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 70c279cbf4b71bd0931a1e438c38cf65aee31ee7
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Aug 4 22:05:50 2009 +0200

    BitVec class refactoring: use size_t as `capacity' and `dataSize' type 
instead of int.

diff --git a/myserver/include/base/bitvec/bitvec.h 
b/myserver/include/base/bitvec/bitvec.h
index 931966c..d59c14c 100644
--- a/myserver/include/base/bitvec/bitvec.h
+++ b/myserver/include/base/bitvec/bitvec.h
@@ -65,7 +65,7 @@ public:
     delete [] data;
   }
   
-  int getCapacity ()
+  size_t getCapacity ()
   {
     return capacity;
   }
@@ -75,8 +75,8 @@ private:
   int lastFound;
 
   long int *data;
-  int dataSize;
-  int capacity;
+  size_t dataSize;
+  size_t capacity;
 };
 
 #endif
diff --git a/myserver/tests/test_bitvec.cpp b/myserver/tests/test_bitvec.cpp
index 7d7487e..1c26f8d 100644
--- a/myserver/tests/test_bitvec.cpp
+++ b/myserver/tests/test_bitvec.cpp
@@ -47,11 +47,11 @@ public:
 
   void testInit ()
   {
-    int N = 100;
+    size_t N = 100;
     BitVec vec (N, false);
     CPPUNIT_ASSERT_EQUAL (vec.getCapacity (), N);
 
-    for (int i = 1; i < 100; i += 10)
+    for (size_t i = 1; i < 100; i += 10)
       {
         vec.init (i, false);
         CPPUNIT_ASSERT_EQUAL (vec.getCapacity (), i);
@@ -107,7 +107,7 @@ public:
   void testRevert ()
   {
     BitVec vec (200, true);
-    for (int i = 18; i < 120; i += 2)
+    for (size_t i = 18; i < 120; i += 2)
       {
         CPPUNIT_ASSERT_EQUAL (vec.get (i), true);
         vec.unset (i);
@@ -121,14 +121,14 @@ public:
   {
     BitVec vec (200, false);
 
-    for (int i = 0; i < 80; i += 3)
+    for (size_t i = 0; i < 80; i += 3)
       {
         CPPUNIT_ASSERT_EQUAL (vec.get (i), false);
         vec.set (i);
         CPPUNIT_ASSERT_EQUAL (vec.get (i), true);
       }
 
-    for (int i = 0; i < 80; i += 3)
+    for (size_t i = 0; i < 80; i += 3)
       {
         int j = vec.find ();
 



commit 14c1af986336bf420b2c3f65e44b30017145561e
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Aug 4 21:54:07 2009 +0200

    Slab class refactoring: use size_t for capacity, not int.  Add a check 
against the index returned by the bit mask.

diff --git a/myserver/include/base/slab/slab.h 
b/myserver/include/base/slab/slab.h
index d8d145c..375de35 100644
--- a/myserver/include/base/slab/slab.h
+++ b/myserver/include/base/slab/slab.h
@@ -27,13 +27,13 @@ template<class T>
 class Slab
 {
 public:
-  Slab<T> (int capacity) : mask (capacity, true)
+  Slab<T> (size_t capacity) : mask (capacity, true)
   {
     this->capacity = capacity;
     data = new T[capacity];
   }
 
-  void init (int capacity)
+  void init (size_t capacity)
   {
     mask.init (capacity, true);
     this->capacity = capacity;
@@ -41,7 +41,7 @@ public:
     data = new T[capacity];
   }
 
-  int getCapacity ()
+  size_t getCapacity ()
   {
     return capacity;
   }
@@ -60,7 +60,7 @@ public:
   {
     int i = mask.find ();
 
-    if (i == -1)
+    if (i == -1 || i >= capacity)
       return NULL;
 
     mask.unset (i);
@@ -70,9 +70,9 @@ public:
 
   void put (T* t)
   {
-    int i = t - data;
+    size_t i = t - data;
 
-    if (i >= 0 && i < capacity)
+    if (i < capacity)
       mask.set (i);
     else
       delete t;
@@ -85,7 +85,7 @@ public:
 
 private:
   BitVec mask;
-  int capacity;
+  size_t capacity;
   T *data;
 };
 
diff --git a/myserver/tests/test_slab.cpp b/myserver/tests/test_slab.cpp
index c33cd61..4d08d28 100644
--- a/myserver/tests/test_slab.cpp
+++ b/myserver/tests/test_slab.cpp
@@ -51,11 +51,11 @@ public:
 
   void testInit ()
   {
-    int N = 10;
+    size_t N = 10;
     Slab<TestSlabRecord> slabs (N);
     CPPUNIT_ASSERT_EQUAL (slabs.getCapacity (), N);
 
-    for (int i = 1; i < 100; i += 10)
+    for (size_t i = 1; i < 100; i += 10)
       {
         slabs.init (i);
         CPPUNIT_ASSERT_EQUAL (slabs.getCapacity (), i);
@@ -64,7 +64,7 @@ public:
 
   void testCapacity ()
   {
-    int N = 100;
+    size_t N = 100;
     Slab<TestSlabRecord> slabs (N);
 
     CPPUNIT_ASSERT_EQUAL (slabs.getCapacity (), N);
@@ -72,7 +72,7 @@ public:
 
   void testGet ()
   {
-    int N = 100;
+    size_t N = 100;
     Slab<TestSlabRecord> slabs (N);
     TestSlabRecord *recs[N];
 
@@ -94,7 +94,7 @@ public:
 
   void testForcedGet ()
   {
-    int N = 100;
+    size_t N = 100;
     Slab<TestSlabRecord> slabs (N);
     TestSlabRecord *recs[N * 2];
 



commit 22db7d21bcb370b861af4c36d5ad80340177ab6f
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Aug 4 21:49:47 2009 +0200

    Check that the returned index is less than the specified `capacity'.

diff --git a/myserver/src/base/bitvec/bitvec.cpp 
b/myserver/src/base/bitvec/bitvec.cpp
index 7b97185..c47871c 100644
--- a/myserver/src/base/bitvec/bitvec.cpp
+++ b/myserver/src/base/bitvec/bitvec.cpp
@@ -82,7 +82,9 @@ int BitVec::ffs ()
   for (int i = 0; i < dataSize; i++)
     if (p = ffsl (data[i]))
       {
-        return (i * sizeof (long int) * 8) + p - 1;
+        int r = (i * sizeof (long int) * 8) + p - 1;
+        if (r < capacity)
+          return r;
       }
 
   return -1;
@@ -106,8 +108,12 @@ int BitVec::find ()
   for (int i = lastFound; i < dataSize + lastFound; i++)
     if (p = ffsl (data[i % dataSize]))
       {
-        lastFound = i;
-        return (i * sizeof (long int) * 8) + p - 1;
+        int r = (i * sizeof (long int) * 8) + p - 1;
+        if (r < capacity)
+          {
+            lastFound = i;
+            return r;
+          }
       }
 
   return -1;



commit d442a438e1402ce99796e231a0b3f90e258df628
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Aug 4 21:47:49 2009 +0200

    Connection class refactoring: dinamically allocate members and hide them to 
be accessed directly from outside.

diff --git a/myserver/include/connection/connection.h 
b/myserver/include/connection/connection.h
index 2c60cb9..8b6cecd 100644
--- a/myserver/include/connection/connection.h
+++ b/myserver/include/connection/connection.h
@@ -57,40 +57,40 @@ public:
   void init ();
   void destroy ();
 
-       int getPriority();
-       void setPriority(int);
+       int getPriority ();
+       void setPriority (int);
 
-  u_long getID();
-  void setID(u_long);
+  u_long getID ();
+  void setID (u_long);
 
-  void setScheduled(int);
-  int isScheduled();
-  int allowDelete(bool bWait = false);
+  void setScheduled (int);
+  int isScheduled ();
+  int allowDelete (bool bWait = false);
 
-  u_short getPort();
-  void setPort(u_short);
+  u_short getPort ();
+  void setPort (u_short);
        
-  u_short getLocalPort();
-  void setLocalPort(u_short);
+  u_short getLocalPort ();
+  void setLocalPort (u_short);
 
-  const char* getLogin();
-  void setLogin(const char*);
+  const char* getLogin ();
+  void setLogin (const char*);
 
-  const char* getPassword();
-  void setPassword(const char*);
+  const char* getPassword ();
+  void setPassword (const char*);
 
        void setnTries(char);
-       char getnTries();
-       void incnTries();
+       char getnTries ();
+       void incnTries ();
 
-  const char* getIpAddr();
-  void setIpAddr(const char*);
+  const char* getIpAddr ();
+  void setIpAddr (const char*);
 
-  const char* getLocalIpAddr();
-  void setLocalIpAddr(const char*);
+  const char* getLocalIpAddr ();
+  void setLocalIpAddr (const char*);
 
-       u_long getTimeout();
-  void setTimeout(u_long);
+       u_long getTimeout ();
+  void setTimeout (u_long);
 
        /*! Connection socket.  */
        Socket *socket;
@@ -98,43 +98,46 @@ public:
        /*! Pointer to an host structure.  */
        Vhost *host;
        
-  int getToRemove();
-  void setToRemove(int);
+  int getToRemove ();
+  void setToRemove (int);
+
+  int isForceControl ();
+  void setForceControl (int);  
 
-  int isForceControl();
-  void setForceControl(int);   
-       
-       /*! This buffer must be used only by the ClientsTHREAD class.  */
-       MemBuf connectionBuffer;
-       
        /*! Buffer for the connection struct. Used by protocols.  */
        ProtocolBuffer *protocolBuffer;
 
        /*! Set the thread that is currently using the connection.  */
-       void setActiveThread(ClientsThread* t){thread = t;}
+       void setActiveThread (ClientsThread* t){thread = t;}
 
        /*! Get the thread that is using the connection.  */
-       ClientsThread* getActiveThread(){return thread;}
+       ClientsThread* getActiveThread (){return thread;}
 
-  Connection()
+  Connection ()
   {
     init ();
   }
 
-  virtual ~Connection()
+  virtual ~Connection ()
   {
     destroy ();
   }
 
   /*! Get the continuation function.  */
-  continuationPROC getContinuation(){return continuation;}
+  continuationPROC getContinuation (){return continuation;}
 
   /*! Set a new continuation function.  */
-  void setContinuation(continuationPROC newContinuation){continuation = 
newContinuation;}
+  void setContinuation (continuationPROC newContinuation){continuation = 
newContinuation;}
 
   /*! Check if the connection/connection.has a continuation.  */
-  bool hasContinuation(){return continuation ? true : false;}
+  bool hasContinuation (){return continuation ? true : false;}
+
+  MemBuf *getConnectionBuffer (){return connectionBuffer;}
 protected:
+       
+       /*! This buffer must be used only by the ClientsTHREAD class.  */
+       MemBuf *connectionBuffer;
+
        ClientsThread *thread;
 
   /*! Continuation function.  */
@@ -150,19 +153,19 @@ protected:
        u_short port;
 
        /*! Login name.  */
-       string login;
+       string *login;
        
        /*! Password used to log in.  */
-       string password;
+       string *password;
 
        /*! # of tries for an authorized login.  */
        char nTries;
 
        /*! Remote IP address.  */
-       string ipAddr;
+       string *ipAddr;
        
        /*! Local IP used to connect to.  */
-       string localIpAddr;
+       string *localIpAddr;
 
        /*! Local port used to connect to.  */
        u_short localPort;
diff --git a/myserver/src/base/thread/thread.cpp 
b/myserver/src/base/thread/thread.cpp
index 2e242b3..b3416ef 100755
--- a/myserver/src/base/thread/thread.cpp
+++ b/myserver/src/base/thread/thread.cpp
@@ -30,11 +30,11 @@ extern "C"
 # include <errno.h>
 # include <netdb.h>
 # include <unistd.h>
-#include <signal.h>
-#ifdef HAVE_PTHREAD
-# include <pthread.h>
-#endif
-#include <sys/wait.h>
+# include <signal.h>
+# ifdef HAVE_PTHREAD
+#  include <pthread.h>
+# endif
+# include <sys/wait.h>
 #endif
 }
 
diff --git a/myserver/src/connection/connection.cpp 
b/myserver/src/connection/connection.cpp
index 48b2998..69f6564 100644
--- a/myserver/src/connection/connection.cpp
+++ b/myserver/src/connection/connection.cpp
@@ -25,11 +25,11 @@ void Connection::init ()
 {
   thread = 0;
   scheduled = 0;
-  login.assign("");
-  password.assign("");
+  login = new string ();
+  password = new string ();
+  ipAddr = new string ();
+  localIpAddr = new string ();
   nTries = 0;
-  ipAddr[0] = '\0';
-  localIpAddr[0] = '\0';
   port = 0;
   localPort = 0;
   timeout = 0;
@@ -40,6 +40,7 @@ void Connection::init ()
   socket = 0;
   priority = -1;
   continuation = NULL;
+       connectionBuffer = new MemBuf ();
 }
 
 /*!
@@ -47,33 +48,54 @@ void Connection::init ()
  */
 void Connection::destroy ()
 {
-  if(socket)
+  if (socket)
   {
-    socket->shutdown(SD_BOTH);
+    socket->shutdown (SD_BOTH);
     char buffer[256];
     int buffersize = 256;
     int err;
-    do
-    {
-      err = socket->recv(buffer, buffersize, 0);
-    }while((err != -1) && err);
 
-    socket->close();
+    socket->close ();
     delete socket;
+    socket = NULL;
   }
 
+  if (login)
+    delete login;
+
+  if (password)
+    delete password;
+
+  if(ipAddr)
+    delete ipAddr;
+
+  if (localIpAddr)
+    delete localIpAddr;
+
+  if (connectionBuffer)
+    delete connectionBuffer;
+
   if(protocolBuffer)
     delete protocolBuffer;
 
   /*! Remove the reference for the vhost. */
-  if(host)
-    ((Vhost*)host)->removeRef();
+  if (host)
+    ((Vhost*)host)->removeRef ();
+
+  login = NULL;
+  password = NULL;
+  ipAddr = NULL;
+  localIpAddr = NULL;
+  protocolBuffer = NULL;
+  connectionBuffer = NULL;
+
+  host = NULL;
 }
 
 /*!
  *Return the IDentifier for the connection.
  */
-u_long Connection::getID()
+u_long Connection::getID ()
 {
   return ID;
 }
@@ -82,7 +104,7 @@ u_long Connection::getID()
  *Set the IDentifier for the connection.
  *\param nID The new ID. 
  */
-void Connection::setID(u_long nID)
+void Connection::setID (u_long nID)
 {
   ID = nID;
 }
@@ -91,7 +113,7 @@ void Connection::setID(u_long nID)
  *Set if the connection is scheduled by the server.
  *\param np The new scheduled state.
  */
-void Connection::setScheduled(int np)
+void Connection::setScheduled (int np)
 {
   scheduled = np;
 }
@@ -99,7 +121,7 @@ void Connection::setScheduled(int np)
 /*!
  *Return if the connection is scheduled.
  */
-int Connection::isScheduled()
+int Connection::isScheduled ()
 {
   return scheduled;
 }
@@ -107,21 +129,21 @@ int Connection::isScheduled()
 /*!
  *Return if the connection may be deleted by the server.
  */
-int Connection::allowDelete(bool bWait/*= false*/)
+int Connection::allowDelete (bool bWait/*= false*/)
 {
-  if ( isScheduled () )
+  if (isScheduled ())
      return 0;
 
-  if ( protocolBuffer != NULL )
-    return protocolBuffer->allowDelete(bWait);
-  
+  if (protocolBuffer != NULL)
+    return protocolBuffer->allowDelete (bWait);
+
   return 1;
 }
 
 /*!
  *Get the port used by the connection.
  */
-u_short Connection::getPort()
+u_short Connection::getPort ()
 {
   return port;
 }
@@ -130,7 +152,7 @@ u_short Connection::getPort()
  *Set the port used by the connection.
  *\param newPort The new port.
  */
-void Connection::setPort(u_short newPort)
+void Connection::setPort (u_short newPort)
 {
   port = newPort;
 }
@@ -138,25 +160,25 @@ void Connection::setPort(u_short newPort)
 /*!
  *Get the login name used by the connection user.
  */
-const char* Connection::getLogin()
+const char* Connection::getLogin ()
 {
-  return login.c_str();
+  return login->c_str();
 }
 
 /*!
  *Set the login name for the connection user.
  *\param loginName The login name. 
  */
-void Connection::setLogin(const char* loginName)
+void Connection::setLogin (const char* loginName)
 {
-  login.assign(loginName);
+  login->assign (loginName);
 }
 
 /*!
  *Set the # of attempts to authenticate the user.
  *\arg n The new number of tries.
  */
-void Connection::setnTries(char n)
+void Connection::setnTries (char n)
 {
   nTries = n;
 }
@@ -164,14 +186,14 @@ void Connection::setnTries(char n)
 /*!
  *Get the attempts number to authenticate the user.
  */
-char Connection::getnTries()
+char Connection::getnTries ()
 {
   return nTries;
 }
 /*!
  *Increment by 1 the # of attempts to authenticate the user.
  */
-void Connection::incnTries()
+void Connection::incnTries ()
 {
   nTries++;
 }
@@ -179,41 +201,41 @@ void Connection::incnTries()
 /*!
  *Get the IP address of the client.
  */
-const char* Connection::getIpAddr()
+const char* Connection::getIpAddr ()
 {
-  return ipAddr.c_str();
+  return ipAddr->c_str();
 }
 
 /*!
  *Set the IP address of the client.
  *\param na The new IP address.
  */
-void Connection::setIpAddr(const char* na)
+void Connection::setIpAddr (const char* na)
 {
-  ipAddr.assign(na);
+  ipAddr->assign (na);
 }
 
 /*!
  *Get the IP address of the local interface used to connect to.
  */
-const char* Connection::getLocalIpAddr()
+const char* Connection::getLocalIpAddr ()
 {
-  return localIpAddr.c_str();
+  return localIpAddr->c_str ();
 }
 
 /*!
  *Set the IP address of the local interface used to connect to.
  *\param na The new local IP address.
  */
-void Connection::setLocalIpAddr(const char* na)
+void Connection::setLocalIpAddr (const char* na)
 {
-  localIpAddr.assign(na);
+  localIpAddr->assign (na);
 }
 
 /*!
  *Get the local port used to connect to.
  */
-u_short Connection::getLocalPort()
+u_short Connection::getLocalPort ()
 {
   return localPort;
 }
@@ -222,7 +244,7 @@ u_short Connection::getLocalPort()
  *Set the local port used to connect to.
  *\param np The new local port. 
  */
-void Connection::setLocalPort(u_short np)
+void Connection::setLocalPort (u_short np)
 {
   localPort = np;
 }
@@ -230,7 +252,7 @@ void Connection::setLocalPort(u_short np)
 /*!
  *Get the timeout to use with the connection.
  */
-u_long Connection::getTimeout()
+u_long Connection::getTimeout ()
 {
   return timeout;
 }
@@ -239,7 +261,7 @@ u_long Connection::getTimeout()
  *Set the timeout to use with the connection.
  *\param nTimeout The new timeout value. 
  */
-void Connection::setTimeout(u_long nTimeout)
+void Connection::setTimeout (u_long nTimeout)
 {
   timeout = nTimeout;
 }
@@ -247,7 +269,7 @@ void Connection::setTimeout(u_long nTimeout)
 /*!
  *Return if the connection must be removed and why.
  */
-int Connection::getToRemove()
+int Connection::getToRemove ()
 {
   return toRemove;
 }
@@ -256,7 +278,7 @@ int Connection::getToRemove()
  *Set the reason to remove the connection.
  *\param r Set if the connection/connection.has to be removed. 
  */
-void Connection::setToRemove(int r)
+void Connection::setToRemove (int r)
 {
   toRemove = r;
 }
@@ -264,7 +286,7 @@ void Connection::setToRemove(int r)
 /*!
  *Get if the connection is forced to be parsed.
  */
-int Connection::isForceControl()
+int Connection::isForceControl ()
 {
   return forceControl;
 }
@@ -272,7 +294,7 @@ int Connection::isForceControl()
  *Force the control of this connection on next server loop.
  *\param fp The new force control value even if there is new data. 
  */
-void Connection::setForceControl(int fp)
+void Connection::setForceControl (int fp)
 {
   forceControl = fp;
 }
@@ -280,24 +302,24 @@ void Connection::setForceControl(int fp)
 /*!
  *Return the password submitted by the user.
  */
-const char* Connection::getPassword()
+const char* Connection::getPassword ()
 {
-  return password.c_str();
+  return password->c_str();
 }
 
 /*!
  *Set the password for the user.
  *\param p The new password.
  */
-void Connection::setPassword(const char* p)
+void Connection::setPassword (const char* p)
 {
-  password.assign(p);
+  password->assign(p);
 }
 
 /*!
  *Get the connection priority.
  */
-int Connection::getPriority()
+int Connection::getPriority ()
 {
   return priority;
 }
@@ -306,7 +328,7 @@ int Connection::getPriority()
  *Set the connection priority.
  *\param p The new priority.
  */
-void Connection::setPriority(int p)
+void Connection::setPriority (int p)
 {
   priority = p;
 }
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 32ce74c..93f18ce 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1169,9 +1169,11 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
 
                   if (remainingData)
                     {
+                      const char *data = (td->buffer->getBuffer ()
+                                          + td->nHeaderChars);
                       u_long toCopy = nbtr - td->nHeaderChars;
-                      a->connectionBuffer.setBuffer ((td->buffer->getBuffer () 
+ td->nHeaderChars),
-                                                     toCopy);
+
+                      a->getConnectionBuffer()->setBuffer (data, toCopy);
                       retvalue = ClientsThread::INCOMPLETE_REQUEST_NO_WAIT;
                     }
                   else
diff --git a/myserver/src/server/clients_thread.cpp 
b/myserver/src/server/clients_thread.cpp
index ea4c07b..6fe7768 100644
--- a/myserver/src/server/clients_thread.cpp
+++ b/myserver/src/server/clients_thread.cpp
@@ -305,7 +305,7 @@ int ClientsThread::controlConnections()
     return 1;
 
   busy = 1;
-  dataRead = c->connectionBuffer.getLength();
+  dataRead = c->getConnectionBuffer ()->getLength ();
 
   err = c->socket->recv(&((char*)(buffer.getBuffer()))[dataRead],
                         MYSERVER_KB(8) - dataRead - 1, 0);
@@ -337,69 +337,65 @@ int ClientsThread::controlConnections()
 
   if(dataRead)
   {
-    memcpy((char*)buffer.getBuffer(), c->connectionBuffer, dataRead);
+    memcpy((char*)buffer.getBuffer(), c->getConnectionBuffer ()->getBuffer (), 
dataRead);
   }
 
   c->setActiveThread(this);
   try
   {
-    if (c->hasContinuation())
-    {
-      retcode = c->getContinuation()(c, 
-                                     (char*)buffer.getBuffer(), 
-                                     (char*)secondaryBuffer.getBuffer(), 
-                                     buffer.getRealLength(), 
-                                     secondaryBuffer.getRealLength(), 
-                                     nBytesToRead, 
-                                     id);
-      c->setContinuation(NULL);
-    }
+    if (c->hasContinuation ())
+      {
+        retcode = c->getContinuation ()(c, (char*)buffer.getBuffer(), 
+                                   (char*)secondaryBuffer.getBuffer(), 
+                                   buffer.getRealLength(), 
+                                   secondaryBuffer.getRealLength(), 
+                                   nBytesToRead, id);
+        c->setContinuation (NULL);
+      }
     else
-    {
-      protocol = server->getProtocol(c->host->getProtocolName());
-      if(protocol)
       {
-        retcode = protocol->controlConnection(c, 
-                                              (char*)buffer.getBuffer(), 
-                                              
(char*)secondaryBuffer.getBuffer(), 
+        protocol = server->getProtocol (c->host->getProtocolName ());
+        if (protocol)
+          {
+            retcode = protocol->controlConnection(c, (char*)buffer.getBuffer(),
+                                             
(char*)secondaryBuffer.getBuffer(), 
                                               buffer.getRealLength(), 
-                                              secondaryBuffer.getRealLength(), 
-                                              nBytesToRead, 
-                                              id);
+                                             secondaryBuffer.getRealLength(), 
+                                             nBytesToRead, id);
+          }
+        else
+          retcode = DELETE_CONNECTION;
       }
-      else
-        retcode = DELETE_CONNECTION;
-    }
   }
-  catch(...)
-  {
-    retcode = DELETE_CONNECTION;
-  };
+  catch (...)
+    {
+      retcode = DELETE_CONNECTION;
+    };
 
-  c->setTimeout( getTicks() );
+  c->setTimeout (getTicks ());
 
-  /*! Delete the connection.  */
-  if(retcode == DELETE_CONNECTION)
+  /* Delete the connection.  */
+  if (retcode == DELETE_CONNECTION)
   {
-    server->deleteConnection(c);
+    server->deleteConnection (c);
     return 0;
   }
-  /*! Keep the connection.  */
-  else if(retcode == KEEP_CONNECTION)
+  /* Keep the connection.  */
+  else if (retcode == KEEP_CONNECTION)
   {
-    c->connectionBuffer.setLength(0);
-    server->getConnectionsScheduler()->addWaitingConnection(c);
+    c->getConnectionBuffer ()->setLength (0);
+    server->getConnectionsScheduler ()->addWaitingConnection (c);
   }
-  /*! Incomplete request to buffer.  */
-  else if(retcode == INCOMPLETE_REQUEST)
+  /* Incomplete request to buffer.  */
+  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.
      */
-    c->connectionBuffer.setBuffer(buffer.getBuffer(), nBytesToRead);
-    server->getConnectionsScheduler()->addWaitingConnection(c);
+    c->getConnectionBuffer ()->setBuffer (buffer.getBuffer (), nBytesToRead);
+    server->getConnectionsScheduler ()->addWaitingConnection (c);
   }
   /* Incomplete request to check before new data is available.  */
   else if(retcode == INCOMPLETE_REQUEST_NO_WAIT)

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

Summary of changes:
 myserver/include/base/bitvec/bitvec.h    |    6 +-
 myserver/include/base/slab/slab.h        |   14 ++--
 myserver/include/connection/connection.h |   87 +++++++++++----------
 myserver/src/base/bitvec/bitvec.cpp      |   12 ++-
 myserver/src/base/thread/thread.cpp      |   10 +-
 myserver/src/connection/connection.cpp   |  128 +++++++++++++++++------------
 myserver/src/protocol/http/http.cpp      |    6 +-
 myserver/src/server/clients_thread.cpp   |   78 +++++++++----------
 myserver/tests/test_bitvec.cpp           |   10 +-
 myserver/tests/test_slab.cpp             |   10 +-
 10 files changed, 195 insertions(+), 166 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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