gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5310 - in GNUnet/src: include server transports util/netwo


From: gnunet
Subject: [GNUnet-SVN] r5310 - in GNUnet/src: include server transports util/network
Date: Sun, 15 Jul 2007 11:47:12 -0600 (MDT)

Author: grothoff
Date: 2007-07-15 11:47:10 -0600 (Sun, 15 Jul 2007)
New Revision: 5310

Modified:
   GNUnet/src/include/gnunet_core.h
   GNUnet/src/include/gnunet_transport.h
   GNUnet/src/server/connection.c
   GNUnet/src/server/connection.h
   GNUnet/src/server/handler.c
   GNUnet/src/server/tcpserver.c
   GNUnet/src/server/tcpserver.h
   GNUnet/src/transports/tcp_helper.c
   GNUnet/src/util/network/select.c
Log:
fmt

Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h    2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/include/gnunet_core.h    2007-07-15 17:47:10 UTC (rev 5310)
@@ -162,7 +162,7 @@
  */
 typedef int (*SendToClientCallback) (struct ClientHandle * handle,
                                      const MESSAGE_HEADER * message,
-                                    int force);
+                                     int force);
 
 /**
  * GNUnet CORE API for applications and services that are implemented
@@ -628,7 +628,7 @@
   struct GE_Context *(*createClientLogContext) (GE_KIND mask,
                                                 struct ClientHandle * handle);
 
-  int (*assertUnused)(TSession * tsession);
+  int (*assertUnused) (TSession * tsession);
 
 } CoreAPIForApplication;
 

Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h       2007-07-15 17:46:06 UTC (rev 
5309)
+++ GNUnet/src/include/gnunet_transport.h       2007-07-15 17:47:10 UTC (rev 
5310)
@@ -158,7 +158,7 @@
    */
   int (*releaseService) (void *service);
 
-  int (*assertUnused)(TSession * tsession);
+  int (*assertUnused) (TSession * tsession);
 
 
 } CoreAPIForTransport;

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/server/connection.c      2007-07-15 17:47:10 UTC (rev 5310)
@@ -1532,7 +1532,7 @@
   int ret;
   SendEntry **entries;
   unsigned int stotal;
-  TSession * tsession;
+  TSession *tsession;
 
   ENTRY ();
   /* fast ways out */
@@ -2000,7 +2000,7 @@
 {
   P2P_hangup_MESSAGE hangup;
   unsigned int i;
-  TSession * tsession;
+  TSession *tsession;
 #if DEBUG_CONNECTION
   EncName enc;
 #endif
@@ -3094,7 +3094,7 @@
 {
   BufferEntry *be;
   unsigned int cost;
-  TSession * ts;
+  TSession *ts;
 
   ENTRY ();
   if (tsession == NULL)
@@ -3130,10 +3130,11 @@
       (transport->associate (tsession) == OK))
     {
       ts = be->session.tsession;
-      if (ts != NULL) {
-       be->session.tsession = NULL;
-        transport->disconnect (ts);
-      }
+      if (ts != NULL)
+        {
+          be->session.tsession = NULL;
+          transport->disconnect (ts);
+        }
       be->session.tsession = tsession;
       be->session.mtu = transport->getMTU (tsession->ttype);
       fragmentIfNecessary (be);
@@ -3353,7 +3354,7 @@
           shutdownConnection (be);
           prev = be;
           be = be->overflowChain;
-         CONNECTION_buffer_[i] = be;
+          CONNECTION_buffer_[i] = be;
           FREE (prev);
         }
     }
@@ -3836,9 +3837,11 @@
  * Verify that the given session handle is not in use.
  * @return OK if that is true, SYSERR if not.
  */
-int assertUnused(TSession * tsession) {
+int
+assertUnused (TSession * tsession)
+{
   int i;
-  BufferEntry * root;
+  BufferEntry *root;
 
   MUTEX_LOCK (lock);
   for (i = 0; i < CONNECTION_MAX_HOSTS_; i++)
@@ -3846,13 +3849,14 @@
       root = CONNECTION_buffer_[i];
       while (NULL != root)
         {
-         if (root->session.tsession == tsession) {
-           GE_BREAK(ectx, 0);
-           MUTEX_UNLOCK (lock);
-           return SYSERR;
-         }
-         root = root->overflowChain;
-       }
+          if (root->session.tsession == tsession)
+            {
+              GE_BREAK (ectx, 0);
+              MUTEX_UNLOCK (lock);
+              return SYSERR;
+            }
+          root = root->overflowChain;
+        }
     }
   MUTEX_UNLOCK (lock);
 

Modified: GNUnet/src/server/connection.h
===================================================================
--- GNUnet/src/server/connection.h      2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/server/connection.h      2007-07-15 17:47:10 UTC (rev 5310)
@@ -310,7 +310,7 @@
  * Verify that the given session handle is not in use.
  * @return OK if that is true, SYSERR if not.
  */
-int assertUnused(TSession * tsession);
+int assertUnused (TSession * tsession);
 
 #endif
 /* end of connection.h */

Modified: GNUnet/src/server/handler.c
===================================================================
--- GNUnet/src/server/handler.c 2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/server/handler.c 2007-07-15 17:47:10 UTC (rev 5310)
@@ -702,8 +702,8 @@
       return;
     }
   /* try to increment session reference count */
-  if ( (mp->tsession != NULL) &&
-       (SYSERR == transport->associate (mp->tsession)) )
+  if ((mp->tsession != NULL) &&
+      (SYSERR == transport->associate (mp->tsession)))
     mp->tsession = NULL;
 
   MUTEX_LOCK (globalLock_);

Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c       2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/server/tcpserver.c       2007-07-15 17:47:10 UTC (rev 5310)
@@ -195,7 +195,7 @@
  */
 int
 sendToClient (struct ClientHandle *handle, const MESSAGE_HEADER * message,
-             int force)
+              int force)
 {
 #if DEBUG_TCPHANDLER
   GE_LOG (ectx,

Modified: GNUnet/src/server/tcpserver.h
===================================================================
--- GNUnet/src/server/tcpserver.h       2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/server/tcpserver.h       2007-07-15 17:47:10 UTC (rev 5310)
@@ -84,8 +84,7 @@
  * transfer happens asynchronously.
  */
 int sendToClient (struct ClientHandle *handle,
-                  const MESSAGE_HEADER * message,
-                 int force);
+                  const MESSAGE_HEADER * message, int force);
 
 
 /**

Modified: GNUnet/src/transports/tcp_helper.c
===================================================================
--- GNUnet/src/transports/tcp_helper.c  2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/transports/tcp_helper.c  2007-07-15 17:47:10 UTC (rev 5310)
@@ -160,22 +160,24 @@
     {
       MUTEX_UNLOCK (tcpsession->lock);
       MUTEX_UNLOCK (tcplock);
-      if (tcpsession->users == 0) {
-        select_change_timeout (selector, tcpsession->sock, TCP_FAST_TIMEOUT);
-       GE_ASSERT(ectx,
-                 OK == coreAPI->assertUnused(tsession));
-      }
+      if (tcpsession->users == 0)
+        {
+          select_change_timeout (selector, tcpsession->sock,
+                                 TCP_FAST_TIMEOUT);
+          GE_ASSERT (ectx, OK == coreAPI->assertUnused (tsession));
+        }
       return OK;
     }
   MUTEX_UNLOCK (tcpsession->lock);
   MUTEX_UNLOCK (tcplock);
-  if (OK != coreAPI->assertUnused(tsession)) {
-    GE_BREAK(ectx, 0);
-    abort(); /* for now */
-    /* recovery attempt */
-    tcpsession->users = 1;
-    return OK;
-  }
+  if (OK != coreAPI->assertUnused (tsession))
+    {
+      GE_BREAK (ectx, 0);
+      abort ();                 /* for now */
+      /* recovery attempt */
+      tcpsession->users = 1;
+      return OK;
+    }
 #if DEBUG_TCP
   GE_LOG (ectx,
           GE_DEBUG | GE_USER | GE_BULK,
@@ -310,13 +312,13 @@
               tcpSession->accept_addr = NULL;
               tcpSession->addr_len = 0;
               MUTEX_UNLOCK (pos->lock);
-             MUTEX_UNLOCK (tcplock);
+              MUTEX_UNLOCK (tcplock);
               tcpDisconnect (tsession);
               tcpSession->in_select = NO;
               freeTCPSession (tcpSession);
               tcpSession = pos;
               tsession = pos->tsession;
-             MUTEX_LOCK (tcplock);
+              MUTEX_LOCK (tcplock);
               break;
             }
           pos = pos->next;

Modified: GNUnet/src/util/network/select.c
===================================================================
--- GNUnet/src/util/network/select.c    2007-07-15 17:46:06 UTC (rev 5309)
+++ GNUnet/src/util/network/select.c    2007-07-15 17:47:10 UTC (rev 5310)
@@ -398,7 +398,7 @@
               /* free compaction! */
               session->wspos = 0;
               session->wapos = 0;
-             session->no_read = NO;
+              session->no_read = NO;
               if (session->wsize > sh->memory_quota)
                 {
                   /* if we went over quota before because of
@@ -498,8 +498,8 @@
           else
             {
               add_to_select_set (sock, &errorSet, &max);
-             if (session->no_read != YES)
-               add_to_select_set (sock, &readSet, &max);
+              if (session->no_read != YES)
+                add_to_select_set (sock, &readSet, &max);
               GE_ASSERT (NULL, session->wapos >= session->wspos);
               if (session->wapos > session->wspos)
                 add_to_select_set (sock, &writeSet, &max);      /* do we have 
a pending write request? */
@@ -962,11 +962,11 @@
       return SYSERR;
     }
   GE_ASSERT (NULL, session->wapos >= session->wspos);
-  if ( (force == NO) &&
-       ( ( (sh->memory_quota > 0) &&
-          (session->wapos - session->wspos + len > sh->memory_quota) ) ||
-        ( (sh->memory_quota == 0) &&
-          (session->wapos - session->wspos + len > MAX_MALLOC_CHECKED / 2) ) ) 
) 
+  if ((force == NO) &&
+      (((sh->memory_quota > 0) &&
+        (session->wapos - session->wspos + len > sh->memory_quota)) ||
+       ((sh->memory_quota == 0) &&
+        (session->wapos - session->wspos + len > MAX_MALLOC_CHECKED / 2))))
     {
       /* not enough free space, not allowed to grow that much */
       MUTEX_UNLOCK (sh->lock);
@@ -1011,8 +1011,8 @@
   GE_ASSERT (NULL, session->wapos + len <= session->wsize);
   memcpy (&session->wbuff[session->wapos], msg, len);
   session->wapos += len;
-  if (mayBlock) 
-    session->no_read = YES;  
+  if (mayBlock)
+    session->no_read = YES;
   MUTEX_UNLOCK (sh->lock);
   signalSelect (sh);
   return OK;





reply via email to

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