gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5637 - GNUnet/src/transports


From: gnunet
Subject: [GNUnet-SVN] r5637 - GNUnet/src/transports
Date: Tue, 11 Sep 2007 20:01:19 -0600 (MDT)

Author: grothoff
Date: 2007-09-11 20:01:19 -0600 (Tue, 11 Sep 2007)
New Revision: 5637

Modified:
   GNUnet/src/transports/http.c
Log:
fix early free

Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c        2007-09-12 00:57:04 UTC (rev 5636)
+++ GNUnet/src/transports/http.c        2007-09-12 02:01:19 UTC (rev 5637)
@@ -288,6 +288,11 @@
   int is_client;
 
   /**
+   * Is MHD still using this session handle?
+   */
+  int is_mhd_active;
+
+  /**
    * Data maintained for the http client-server connection
    * (depends on if we are client or server).
    */
@@ -668,6 +673,7 @@
       gpos = gpos->next;
     }
 #endif
+  httpsession->is_mhd_active--;
 }
 
 /**
@@ -981,7 +987,7 @@
       memset (httpSession, 0, sizeof (HTTPSession));
       httpSession->sender.hashPubKey = client;
       httpSession->lock = MUTEX_CREATE (YES);
-      httpSession->users = 0;   /* nobody yet */
+      httpSession->users = 0;   /* MHD */
       tsession = MALLOC (sizeof (TSession));
       memset (tsession, 0, sizeof (TSession));
       tsession->ttype = HTTP_PROTOCOL_NUMBER;
@@ -990,7 +996,10 @@
       httpSession->tsession = tsession;
       addTSession (tsession);
     }
-  *httpSessionCache = httpSession;
+  if (*httpSessionCache == NULL) {
+    httpSession->is_mhd_active++;
+    *httpSessionCache = httpSession;
+  }
   MUTEX_LOCK (httpSession->lock);
 #if DO_GET
   if (0 == strcasecmp (MHD_HTTP_METHOD_GET, method))
@@ -1789,8 +1798,9 @@
 #endif
           if (
 #if DO_GET
-               (s->cs.server.gets == NULL) &&
+               (s->cs.server.gets == NULL) &&         
 #endif
+              (s->is_mhd_active == 0) &&
                (s->users == 0))
             {
               MUTEX_UNLOCK (s->lock);





reply via email to

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