gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3738 - GNUnet/src/util/network


From: grothoff
Subject: [GNUnet-SVN] r3738 - GNUnet/src/util/network
Date: Sun, 12 Nov 2006 19:31:38 -0800 (PST)

Author: grothoff
Date: 2006-11-12 19:31:37 -0800 (Sun, 12 Nov 2006)
New Revision: 3738

Modified:
   GNUnet/src/util/network/select.c
Log:
fixing types and a deadlock

Modified: GNUnet/src/util/network/select.c
===================================================================
--- GNUnet/src/util/network/select.c    2006-11-13 03:29:02 UTC (rev 3737)
+++ GNUnet/src/util/network/select.c    2006-11-13 03:31:37 UTC (rev 3738)
@@ -59,6 +59,12 @@
 
   cron_t lastUse;
 
+  /**
+   * 0 : can be destroyed
+   * 1 : if destruction is required, it must be delayed
+   * -1: delayed destruction required
+   * 2 : destruction in progress
+   */
   int locked;
 
   /**
@@ -296,8 +302,8 @@
     /* do we have the entire message? */
     if (session->pos < len)
       break; /* wait for more */
-
-    session->locked = 1;
+    if (session->locked == 0)
+      session->locked = 1;
     MUTEX_UNLOCK(sh->lock);
     if (OK != sh->mh(sh->mh_cls,
                     sh,
@@ -305,7 +311,8 @@
                     session->sock_ctx,
                     pack)) {
       MUTEX_LOCK(sh->lock);
-      session->locked = 0;
+      if (session->locked == 1)
+       session->locked = 0;
       destroySession(sh, session);
       return SYSERR;
     }
@@ -315,7 +322,8 @@
       destroySession(sh, session);
       return OK;
     }
-    session->locked = 0;
+    if (session->locked == 1)
+      session->locked = 0;
     /* shrink buffer adequately */
     memmove(&session->rbuff[0],
            &session->rbuff[len],





reply via email to

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