gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4737 - in GNUnet/src: applications/transport server transp


From: gnunet
Subject: [GNUnet-SVN] r4737 - in GNUnet/src: applications/transport server transports
Date: Mon, 2 Apr 2007 18:09:09 -0600 (MDT)

Author: grothoff
Date: 2007-04-02 18:09:09 -0600 (Mon, 02 Apr 2007)
New Revision: 4737

Modified:
   GNUnet/src/applications/transport/transport.c
   GNUnet/src/server/connection.c
   GNUnet/src/transports/udp.c
Log:
code cleanup

Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c       2007-04-03 00:08:48 UTC 
(rev 4736)
+++ GNUnet/src/applications/transport/transport.c       2007-04-03 00:09:09 UTC 
(rev 4737)
@@ -177,30 +177,32 @@
  *        if SYSERR is returned!
  * @return OK on success, SYSERR on error
  */
-static TSession * transportConnect(const P2P_hello_MESSAGE * helo) {
+static TSession * 
+transportConnect(const P2P_hello_MESSAGE * hello) {
   unsigned short prot;
   TSession * tsession;
 
-  prot = ntohs(helo->protocol);
-  if ( (ntohs(helo->protocol) >= tapis_count)  ||
+  prot = ntohs(hello->protocol);
+  if ( (prot >= tapis_count)  ||
        (tapis[prot] == NULL) ) {
     GE_LOG(ectx,
           GE_INFO | GE_REQUEST | GE_USER | GE_ADMIN,
           _("Transport connection attempt failed, transport type %d not 
supported\n"),
-          ntohs(helo->protocol));
+          prot);
     return NULL;
   }
-  if (OK != tapis[prot]->connect(helo,
+  if (OK != tapis[prot]->connect(hello,
                                 &tsession))
     return NULL;
   tsession->ttype = prot;
   return tsession;
 }
 
-static TSession * transportConnectFreely(const PeerIdentity * peer,
-                                        int useTempList) {
+static TSession * 
+transportConnectFreely(const PeerIdentity * peer,
+                      int useTempList) {
   int i;
-  P2P_hello_MESSAGE * helo;
+  P2P_hello_MESSAGE * hello;
   int * perm;
   TSession * ret;
 
@@ -210,22 +212,19 @@
   for (i=0;i<tapis_count;i++) {
     if (tapis[perm[i]] == NULL)
       continue;
-    helo = identity->identity2Helo(peer,
-                                  perm[i],
-                                  useTempList);
-    if (helo != NULL) {
-      ret = transportConnect(helo);
-      FREE(helo);
-      if (ret != NULL) {
-       FREE(perm);
-       MUTEX_UNLOCK(tapis_lock);
-       return ret;
-      }
-    }
+    hello = identity->identity2Helo(peer,
+                                   perm[i],
+                                   useTempList);
+    if (hello == NULL) 
+      continue;
+    ret = transportConnect(hello);
+    FREE(hello);
+    if (ret != NULL) 
+      break;
   }
   FREE(perm);
   MUTEX_UNLOCK(tapis_lock);
-  return NULL;
+  return ret;
 }
 
 /**

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2007-04-03 00:08:48 UTC (rev 4736)
+++ GNUnet/src/server/connection.c      2007-04-03 00:09:09 UTC (rev 4737)
@@ -2976,7 +2976,7 @@
   unsigned int cost;
 
   ENTRY();
-  if(tsession == NULL)
+  if (tsession == NULL)
     return;
   MUTEX_LOCK(lock);
   be = addHost(sender, NO);
@@ -3441,9 +3441,9 @@
   P2P_PACKET_HEADER *hdr;
 
   GE_ASSERT(ectx, tsession != NULL);
-  if((transport->getMTU(tsession->ttype) > 0) &&
-     (transport->getMTU(tsession->ttype) <
-      size + sizeof(P2P_PACKET_HEADER))) {
+  if ( (transport->getMTU(tsession->ttype) > 0) &&
+       (transport->getMTU(tsession->ttype) <
+       size + sizeof(P2P_PACKET_HEADER)) ) {
     GE_BREAK(ectx, 0);
     return SYSERR;
   }

Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2007-04-03 00:08:48 UTC (rev 4736)
+++ GNUnet/src/transports/udp.c 2007-04-03 00:09:09 UTC (rev 4737)
@@ -510,9 +510,10 @@
  * The exported method. Makes the core api available via a global and
  * returns the udp transport API.
  */
-TransportAPI * inittransport_udp(CoreAPIForTransport * core) {
+TransportAPI * 
+inittransport_udp(CoreAPIForTransport * core) {
   unsigned long long mtu;
-
+  
   ectx = core->ectx;
   cfg = core->cfg;
   load_monitor = core->load_monitor;





reply via email to

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