gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1293 - in GNUnet: . src/applications/advertising src/appli


From: grothoff
Subject: [GNUnet-SVN] r1293 - in GNUnet: . src/applications/advertising src/applications/dht/tools src/applications/fs/ecrs src/applications/fs/fsui src/applications/identity src/applications/session src/applications/testbed src/applications/transport src/include src/server src/transports
Date: Wed, 6 Jul 2005 13:35:53 -0700 (PDT)

Author: grothoff
Date: 2005-07-06 13:35:30 -0700 (Wed, 06 Jul 2005)
New Revision: 1293

Modified:
   GNUnet/ChangeLog
   GNUnet/src/applications/advertising/advertising.c
   GNUnet/src/applications/dht/tools/dht_api.c
   GNUnet/src/applications/fs/ecrs/directory.c
   GNUnet/src/applications/fs/ecrs/keyspace.c
   GNUnet/src/applications/fs/ecrs/meta.c
   GNUnet/src/applications/fs/ecrs/metatest.c
   GNUnet/src/applications/fs/ecrs/metatest2.c
   GNUnet/src/applications/fs/ecrs/search.c
   GNUnet/src/applications/fs/fsui/file_info.c
   GNUnet/src/applications/fs/fsui/fsui.c
   GNUnet/src/applications/fs/fsui/namespace_info.c
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/applications/session/connect.c
   GNUnet/src/applications/testbed/testbed.c
   GNUnet/src/applications/transport/transport.c
   GNUnet/src/include/gnunet_core.h
   GNUnet/src/include/gnunet_datastore_service.h
   GNUnet/src/include/gnunet_dht_lib.h
   GNUnet/src/include/gnunet_ecrs_lib.h
   GNUnet/src/include/gnunet_identity_service.h
   GNUnet/src/include/gnunet_transport.h
   GNUnet/src/include/gnunet_transport_service.h
   GNUnet/src/server/connection.c
   GNUnet/src/server/gnunet-peer-info.c
   GNUnet/src/transports/http.c
   GNUnet/src/transports/tcp.c
   GNUnet/src/transports/tcp6.c
   GNUnet/todo
Log:
bugfixes and API cleanup

Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog    2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/ChangeLog    2005-07-06 20:35:30 UTC (rev 1293)
@@ -1,3 +1,9 @@
+Wed Jul  6 22:34:30 CEST 2005
+       Fixed bugs in core with respect to possible infinite
+       recursion caused by fragmentation callbacks.  Also
+       differenciated between fatal transport sends and
+       transient transport sends.  Cleanup of some APIs.
+       
 Sat Jul  2 17:21:07 CEST 2005
        Fixed bugs in gnunet-pseudonym (listing of namespaces),
        FSUI (double-free for namespace creation), cleaned up

Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c   2005-07-06 18:18:38 UTC 
(rev 1292)
+++ GNUnet/src/applications/advertising/advertising.c   2005-07-06 20:35:30 UTC 
(rev 1293)
@@ -188,10 +188,10 @@
 
   /* Then check if we have seen this HELO before, if it is identical
      except for the TTL, we trust it and do not play PING-PONG */
-  if (OK == identity->identity2Helo(&foreignId,
-                                   ntohs(msg->protocol),
-                                   NO,
-                                   &copy) ) {
+  copy = identity->identity2Helo(&foreignId,
+                                ntohs(msg->protocol),
+                                NO);
+  if (NULL != copy) {
     if ( (ntohs(copy->senderAddressSize) ==
          ntohs(msg->senderAddressSize)) &&
         (0 == memcmp(&msg->MTU,
@@ -376,10 +376,10 @@
     return;
 
   /* establish short-lived connection, send, tear down */
-  if (SYSERR == identity->identity2Helo(hi,
-                                       proto,
-                                       NO,
-                                       &helo)) {
+  helo = identity->identity2Helo(hi,
+                                proto,
+                                NO);
+  if (NULL == helo) {
 #if DEBUG_HELOEXCHANGE
     LOG(LOG_DEBUG,
        "Exit from '%s' (error: '%s' failed).\n",
@@ -521,10 +521,10 @@
   LOG(LOG_CRON,
       "forwarding HELOs\n");
 #endif
-  if (SYSERR == identity->identity2Helo(peer,
-                                       protocol,
-                                       NO,
-                                       &helo))
+  helo = identity->identity2Helo(peer,
+                                protocol,
+                                NO);
+  if (NULL == helo)
     return; /* this should not happen */
   helo->header.type
     = htons(p2p_PROTO_HELO);

Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2005-07-06 20:35:30 UTC (rev 
1293)
@@ -418,7 +418,7 @@
  * @return SYSERR on error, OK on success
  */
 int DHT_LIB_join(Blockstore * store,
-                DHT_TableId * table) {
+                const DHT_TableId * table) {
   TableList * list;
   int i;
 
@@ -470,7 +470,7 @@
  * @param table the ID of the table
  * @return SYSERR on error, OK on success
  */
-int DHT_LIB_leave(DHT_TableId * table) {
+int DHT_LIB_leave(const DHT_TableId * table) {
   TableList * list;
   int i;
   void * unused;

Modified: GNUnet/src/applications/fs/ecrs/directory.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/directory.c 2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/ecrs/directory.c 2005-07-06 20:35:30 UTC (rev 
1293)
@@ -72,12 +72,10 @@
     mdSize = ntohl(mdSize);
     if (mdSize > len - 8 - sizeof(unsigned int) )
       return SYSERR; /* invalid size */
-    if (OK != ECRS_deserializeMetaData(md,
-                                      &data[8 + sizeof(unsigned int)],
-                                      mdSize)) {
-      *md = NULL;      
+    *md = ECRS_deserializeMetaData(&data[8 + sizeof(unsigned int)],
+                                  mdSize);
+    if (*md == NULL) 
       return SYSERR; /* malformed !*/
-    }
     pos = 8 + sizeof(unsigned int) + mdSize;
   }
   while (pos < len) {
@@ -119,9 +117,9 @@
       return SYSERR; /* malformed! */
     }
 
-    if (OK != ECRS_deserializeMetaData(&fi.meta,
-                                      &data[pos],
-                                      mdSize)) {
+    fi.meta = ECRS_deserializeMetaData(&data[pos],
+                                      mdSize);
+    if (fi.meta == NULL) {
       ECRS_freeUri(fi.uri);
       return SYSERR; /* malformed !*/
     }

Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c  2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c  2005-07-06 20:35:30 UTC (rev 
1293)
@@ -85,9 +85,9 @@
   }
   dstURI = (const char*) &kb[1];
   j++;
-  if (OK != ECRS_deserializeMetaData(&fi.meta,
-                                    &((char*)kb)[j],
-                                    size - j)) {
+  fi.meta = ECRS_deserializeMetaData(&((const char*)kb)[j],
+                                    size - j);
+  if (fi.meta == NULL) {
     BREAK(); /* kblock malformed */
     return SYSERR;
   }

Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c      2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/ecrs/meta.c      2005-07-06 20:35:30 UTC (rev 
1293)
@@ -476,10 +476,9 @@
 #if EXTRA_CHECKS
   {
     MetaData * mdx;
-    mdx = NULL;
-    GNUNET_ASSERT(OK == ECRS_deserializeMetaData(&mdx,
-                                                target,
-                                                size));
+    mdx = ECRS_deserializeMetaData(target,
+                                  size);    
+    GNUNET_ASSERT(NULL != mdx);
     ECRS_freeMetaData(mdx);
   }
 #endif
@@ -535,12 +534,13 @@
 /**
  * Deserialize meta-data.  Initializes md.
  * @param size number of bytes available
- * @return OK on success, SYSERR on error (i.e.
+ * @return MD on success, NULL on error (i.e.
  *         bad format)
  */
-int ECRS_deserializeMetaData(MetaData ** md,
-                            const char * input,
-                            unsigned int size) {
+struct ECRS_MetaData *
+ECRS_deserializeMetaData(const char * input,
+                        unsigned int size) {
+  MetaData * md;
   const MetaDataHeader * hdr;
   unsigned int ic;
   char * data;
@@ -551,17 +551,17 @@
   int len;
 
   if (size < sizeof(MetaDataHeader))
-    return SYSERR;
+    return NULL;
   hdr = (const MetaDataHeader*) input;
   if ( (ntohl(hdr->version) & HEADER_VERSION_MASK) != 0)
-    return SYSERR; /* unsupported version */
+    return NULL; /* unsupported version */
   ic = ntohl(hdr->entries);
   compressed = (ntohl(hdr->version) & HEADER_COMPRESSED) != 0;
   if (compressed) {
     dataSize = ntohl(hdr->size) - sizeof(MetaDataHeader);
     if (dataSize > 2 * 1042 * 1024) {
       BREAK();
-      return SYSERR; /* only 2 MB allowed [to make sure we don't blow
+      return NULL; /* only 2 MB allowed [to make sure we don't blow
                        our memory limit because of a mal-formed
                        message... ]*/
     }
@@ -570,14 +570,14 @@
                      dataSize);
     if (data == NULL) {
       BREAK();
-      return SYSERR;
+      return NULL;
     }
   } else {
     data = (char*) &hdr[1];
     dataSize = size - sizeof(MetaDataHeader);
     if (size != ntohl(hdr->size)) {
       BREAK();
-      return SYSERR;
+      return NULL;
     }
   }
 
@@ -591,36 +591,36 @@
     goto FAILURE;
   }
 
-  *md = ECRS_createMetaData();
+  md = ECRS_createMetaData();
   i = 0;
   pos = sizeof(unsigned int) * ic;
   while ( (pos < dataSize) &&
          (i < ic) ) {
     len = strlen(&data[pos])+1;
-    ECRS_addToMetaData(*md,
+    ECRS_addToMetaData(md,
                       (EXTRACTOR_KeywordType) ntohl(((unsigned int*)data)[i]),
                       &data[pos]);
     pos += len;
     i++;
   }
   if (i < ic) { /* oops */
-    ECRS_freeMetaData(*md);
+    ECRS_freeMetaData(md);
     goto FAILURE;
   }
   if (compressed)
     FREE(data);
-  return OK;
+  return md;
  FAILURE:
   if (compressed)
     FREE(data);
-  return SYSERR; /* size too small */
+  return NULL; /* size too small */
 }
 
 /**
  * Does the meta-data claim that this is a directory?
  * Checks if the mime-type is that of a GNUnet directory.
  */
-int ECRS_isDirectory(MetaData * md) {
+int ECRS_isDirectory(const MetaData * md) {
   int i;
 
   for (i=md->itemCount-1;i>=0;i--) {

Modified: GNUnet/src/applications/fs/ecrs/metatest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/metatest.c  2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/ecrs/metatest.c  2005-07-06 20:35:30 UTC (rev 
1293)
@@ -99,9 +99,9 @@
                                     NO))
     ABORT();
   ECRS_freeMetaData(m);
-  if (OK != ECRS_deserializeMetaData(&m,
-                                    val,
-                                    size))
+  m = ECRS_deserializeMetaData(val,
+                              size);
+  if (m == NULL)
     ABORT();
   FREE(val);
   val = MALLOC(256);

Modified: GNUnet/src/applications/fs/ecrs/metatest2.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/metatest2.c 2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/ecrs/metatest2.c 2005-07-06 20:35:30 UTC (rev 
1293)
@@ -54,9 +54,9 @@
                                     NO))
     ABORT();
   ECRS_freeMetaData(m);
-  if (OK != ECRS_deserializeMetaData(&m,
-                                    val,
-                                    size))
+  m = ECRS_deserializeMetaData(val,
+                              size);
+  if (m == NULL)
     ABORT();
   FREE(val);
   ECRS_freeMetaData(m);

Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c    2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/ecrs/search.c    2005-07-06 20:35:30 UTC (rev 
1293)
@@ -279,9 +279,9 @@
   struct ECRS_URI uri;
   int ret;
 
-  if (OK != ECRS_deserializeMetaData(&fi.meta,
-                                    (char*)&nb[1],
-                                    size - sizeof(NBlock))) {
+  fi.meta = ECRS_deserializeMetaData((const char*)&nb[1],
+                                    size - sizeof(NBlock));
+  if (fi.meta == NULL) {
     BREAK(); /* nblock malformed */
     return SYSERR;
   }
@@ -368,9 +368,9 @@
        }
        dstURI = (const char*) &kb[1];
        j++;
-       if (OK != ECRS_deserializeMetaData(&fi.meta,
-                                          &((char*)kb)[j],
-                                          size - j)) {
+       fi.meta = ECRS_deserializeMetaData(&((const char*)kb)[j],
+                                          size - j);
+       if (fi.meta == NULL) {
          BREAK(); /* kblock malformed */
          FREE(kb);
          return SYSERR;
@@ -453,9 +453,9 @@
        }
        dstURI = (const char*) &sb[1];
        j++;
-       if (OK != ECRS_deserializeMetaData(&fi.meta,
-                                          &dstURI[j],
-                                          size - j)) {
+       fi.meta = ECRS_deserializeMetaData(&dstURI[j],
+                                          size - j);
+       if (fi.meta == NULL) {
          BREAK(); /* kblock malformed */
          FREE(sb);
          return SYSERR;

Modified: GNUnet/src/applications/fs/fsui/file_info.c
===================================================================
--- GNUnet/src/applications/fs/fsui/file_info.c 2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/fsui/file_info.c 2005-07-06 20:35:30 UTC (rev 
1293)
@@ -179,9 +179,9 @@
       ECRS_freeUri(fi.uri);
       goto FORMATERROR;
     }
-    if (OK != ECRS_deserializeMetaData(&fi.meta,
-                                      &result[spos],
-                                      msize)) {
+    fi.meta = ECRS_deserializeMetaData(&result[spos],
+                                      msize);
+    if (fi.meta == NULL) {
       ECRS_freeUri(fi.uri);
       goto FORMATERROR;
     }

Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c      2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/fs/fsui/fsui.c      2005-07-06 20:35:30 UTC (rev 
1293)
@@ -257,9 +257,9 @@
     BREAK();
     return SYSERR;
   }
-  if (OK != ECRS_deserializeMetaData(&fi->meta,
-                                    buf,
-                                    size)) {
+  fi->meta = ECRS_deserializeMetaData(buf,
+                                     size);
+  if (fi->meta == NULL) {
     FREE(buf);
     BREAK();
     return SYSERR;

Modified: GNUnet/src/applications/fs/fsui/namespace_info.c
===================================================================
--- GNUnet/src/applications/fs/fsui/namespace_info.c    2005-07-06 18:18:38 UTC 
(rev 1292)
+++ GNUnet/src/applications/fs/fsui/namespace_info.c    2005-07-06 20:35:30 UTC 
(rev 1293)
@@ -125,9 +125,9 @@
 
   size = len - sizeof(int);
   *ranking = ntohl(((int *) buf)[0]);
-  if (OK != ECRS_deserializeMetaData(meta,
-                                    &buf[sizeof(int)],
-                                    size)) {
+  meta = ECRS_deserializeMetaData(&buf[sizeof(int)],
+                                 size);
+  if (meta == NULL) {
     /* invalid data! remove! */
     BREAK();
     UNLINK(fn);
@@ -408,9 +408,9 @@
     BREAK();
     return SYSERR;
   }
-  if (OK != ECRS_deserializeMetaData(&fi->meta,
-                                    &uri[pos],
-                                    size)) {
+  fi->meta = ECRS_deserializeMetaData(&uri[pos],
+                                     size);
+  if (fi->meta == NULL) {
     FREE(buf);
     BREAK();
     return SYSERR;

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/identity/identity.c 2005-07-06 20:35:30 UTC (rev 
1293)
@@ -525,10 +525,10 @@
  * @param result where to store the result
  * @returns SYSERR on failure, OK on success
  */
-static int identity2Helo(const PeerIdentity *  hostId,
-                        unsigned short protocol,
-                        int tryTemporaryList,
-                        HELO_Message ** result) {
+static HELO_Message * identity2Helo(const PeerIdentity *  hostId,
+                                   unsigned short protocol,
+                                   int tryTemporaryList) {
+  HELO_Message * result;
   HostEntry * host;
   char * fn;
   HELO_Message buffer;
@@ -555,13 +555,13 @@
                              &tempHosts[j]->senderIdentity) &&
           ( (ntohs(tempHosts[j]->protocol) == protocol) ||
             (protocol == ANY_PROTOCOL_NUMBER) ) ) {
-       *result = MALLOC(HELO_Message_size(tempHosts[j]));
-       memcpy(*result,
+       result = MALLOC(HELO_Message_size(tempHosts[j]));
+       memcpy(result,
               tempHosts[j],
               HELO_Message_size(tempHosts[j]));        
        MUTEX_UNLOCK(&lock_);
        FREENONNULL(perm);
-       return OK;
+       return result;
       }
     }
     FREENONNULL(perm);
@@ -570,9 +570,8 @@
   host = findHost(hostId);
   if ( (host == NULL) ||
        (host->protocolCount == 0) ) {
-    *result = NULL;
     MUTEX_UNLOCK(&lock_);
-    return SYSERR;
+    return NULL;
   }  
 
   if (protocol == ANY_PROTOCOL_NUMBER)
@@ -580,13 +579,13 @@
 
   for (i=0;i<host->heloCount;i++) {
     if (host->helos[i]->protocol == protocol) {
-      *result
+      result
        = MALLOC(HELO_Message_size(host->helos[i]));
-      memcpy(*result,
+      memcpy(result,
             host->helos[i],
             HELO_Message_size(host->helos[i]));
       MUTEX_UNLOCK(&lock_);
-      return OK;      
+      return result;
     }
   }
   
@@ -611,14 +610,13 @@
                          fn);
     }
     FREE(fn);
-    *result = NULL;
     MUTEX_UNLOCK(&lock_);
-    return SYSERR;    
+    return NULL;  
   }
-  *result = MALLOC(HELO_Message_size(&buffer));
+  result = MALLOC(HELO_Message_size(&buffer));
   size = readFile(fn,
                  HELO_Message_size(&buffer),
-                 *result);      
+                 result);      
   if ((unsigned int)size != HELO_Message_size(&buffer)) {
     if (0 == UNLINK(fn))
       LOG(LOG_WARNING,
@@ -629,10 +627,9 @@
                        "unlink",
                        fn);
     FREE(fn);
-    FREE(*result);
-    *result = NULL;
+    FREE(result);
     MUTEX_UNLOCK(&lock_);
-    return SYSERR;
+    return NULL;
   }
 
   GROW(host->helos,
@@ -641,10 +638,10 @@
   host->helos[host->heloCount-1]
     = MALLOC(HELO_Message_size(&buffer));
   memcpy(host->helos[host->heloCount-1],
-        *result,
+        result,
         HELO_Message_size(&buffer));
   MUTEX_UNLOCK(&lock_);
-  return OK;  
+  return result;  
 }
 
 
@@ -663,10 +660,10 @@
   HELO_Message * helo;
   int res;
 
-  if (SYSERR == identity2Helo(signer,
-                             ANY_PROTOCOL_NUMBER,
-                             YES,
-                             &helo))
+  helo = identity2Helo(signer,
+                      ANY_PROTOCOL_NUMBER,
+                      YES);
+  if (helo == NULL)
     return SYSERR;
   res = verifySig(message, size, sig,
                  &helo->publicKey);

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/session/connect.c   2005-07-06 20:35:30 UTC (rev 
1293)
@@ -234,17 +234,15 @@
   char * pt;
 
   GNUNET_ASSERT(sk != NULL);
-  foreignHelo = NULL;
-  /* create and encrypt sessionkey */
-  if (SYSERR == identity->identity2Helo(hostId,
+  foreignHelo = identity->identity2Helo(hostId,
                                        ANY_PROTOCOL_NUMBER,
-                                       YES,
-                                       &foreignHelo)) {
+                                       YES);
+  /* create and encrypt sessionkey */
+  if (NULL == foreignHelo) {
     LOG(LOG_INFO,
        _("Cannot encrypt sessionkey, other peer not known!\n"));
     return NULL; /* other host not known */
   }
-  GNUNET_ASSERT(foreignHelo != NULL);
 
   size = sizeof(SKEY_Message);
   if (ping != NULL)

Modified: GNUnet/src/applications/testbed/testbed.c
===================================================================
--- GNUnet/src/applications/testbed/testbed.c   2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/applications/testbed/testbed.c   2005-07-06 20:35:30 UTC (rev 
1293)
@@ -129,10 +129,10 @@
   HELO_Message * helo;
   unsigned int proto = ntohs(msg->proto);
 
-  if (SYSERR == identity->identity2Helo(coreAPI->myIdentity,
-                                       proto,
-                                       NO,
-                                       &helo)) {
+  helo = identity->identity2Helo(coreAPI->myIdentity,
+                                proto,
+                                NO);
+  if (NULL == helo) {
     LOG(LOG_WARNING,
        _("TESTBED could not generate HELO message for protocol %u\n"),
        proto);

Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c       2005-07-06 18:18:38 UTC 
(rev 1292)
+++ GNUnet/src/applications/transport/transport.c       2005-07-06 20:35:30 UTC 
(rev 1293)
@@ -228,11 +228,10 @@
   for (i=0;i<tapis_count;i++) {
     if (tapis[perm[i]] == NULL)
       continue;
-    if (OK ==
-       identity->identity2Helo(peer,
-                               perm[i],
-                               useTempList,
-                               &helo)) {
+    helo = identity->identity2Helo(peer,
+                                  perm[i],
+                                  useTempList);
+    if (helo != NULL) {
       ret = transportConnect(helo);
       FREE(helo);      
       if (ret != NULL) {
@@ -300,7 +299,8 @@
  * @param size the size of the message
  * @param isEncrypted YES if the message is encrypted
  * @param crc the CRC of the (plaintext) message
- * @return OK on success, SYSERR on error
+ * @return OK on success, SYSERR on persistent error, NO on
+ *         temporary error
  */
 static int transportSend(TSession * tsession,
                         const void * msg,

Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h    2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/src/include/gnunet_core.h    2005-07-06 20:35:30 UTC (rev 1293)
@@ -390,7 +390,7 @@
    * @return OK on success, SYSERR if there is already a
    *         handler for that type
    */
-  int (*registerHandler)(const unsigned short type,
+  int (*registerHandler)(unsigned short type,
                         MessagePartHandler callback);
 
   /**
@@ -555,7 +555,7 @@
    * @return OK on success, SYSERR if there is already a
    *         handler for that type
    */
-  int (*registerClientHandler)(const unsigned short type,
+  int (*registerClientHandler)(unsigned short type,
                               CSHandler callback);
 
   /**
@@ -567,7 +567,7 @@
    * @return OK on success, SYSERR if there is a different
    *         handler for that type
    */
-  int (*unregisterClientHandler)(const unsigned short type,
+  int (*unregisterClientHandler)(unsigned short type,
                                 CSHandler callback);
 
   /**

Modified: GNUnet/src/include/gnunet_datastore_service.h
===================================================================
--- GNUnet/src/include/gnunet_datastore_service.h       2005-07-06 18:18:38 UTC 
(rev 1292)
+++ GNUnet/src/include/gnunet_datastore_service.h       2005-07-06 20:35:30 UTC 
(rev 1293)
@@ -126,7 +126,7 @@
   /**
    * Get the current on-disk size of the datastore.
    */
-  unsigned long long (*getSize)();
+  unsigned long long (*getSize)(void);
 
   /**
    * Store an item in the datastore.  If the item is

Modified: GNUnet/src/include/gnunet_dht_lib.h
===================================================================
--- GNUnet/src/include/gnunet_dht_lib.h 2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/src/include/gnunet_dht_lib.h 2005-07-06 20:35:30 UTC (rev 1293)
@@ -32,12 +32,12 @@
 /**
  * Initialize DHT_LIB. Call first.
  */
-void DHT_LIB_init();
+void DHT_LIB_init(void);
 
 /**
- * Initialize DHT_LIB. Call after leaving all tables!
+ * Shutdown DHT_LIB. Call after leaving all tables!
  */
-void DHT_LIB_done();
+void DHT_LIB_done(void);
 
 /**
  * Join a table (start storing data for the table).  Join
@@ -52,7 +52,7 @@
  * @return SYSERR on error, OK on success
  */
 int DHT_LIB_join(Blockstore * store,
-                DHT_TableId * table);
+                const DHT_TableId * table);
 
 
 /**
@@ -69,7 +69,7 @@
  *   implies 'use value from gnunet.conf').
  * @return SYSERR on error, OK on success
  */
-int DHT_LIB_leave(DHT_TableId * table);
+int DHT_LIB_leave(const DHT_TableId * table);
 
 
 /**

Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h        2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/include/gnunet_ecrs_lib.h        2005-07-06 20:35:30 UTC (rev 
1293)
@@ -205,12 +205,12 @@
 /**
  * Deserialize meta-data.  Initializes md.
  * @param size number of bytes available
- * @return OK on success, SYSERR on error (i.e.
+ * @return MD on success, NULL on error (i.e.
  *         bad format)
  */
-int ECRS_deserializeMetaData(struct ECRS_MetaData ** md,
-                            const char * input,
-                            unsigned int size);
+struct ECRS_MetaData *
+ECRS_deserializeMetaData(const char * input,
+                        unsigned int size);
 
 /**
  * Does the meta-data claim that this is a directory?
@@ -219,7 +219,7 @@
  * @return YES if it is, NO if it is not, SYSERR if
  *  we have no mime-type information (treat as 'NO')
  */
-int ECRS_isDirectory(struct ECRS_MetaData * md);
+int ECRS_isDirectory(const struct ECRS_MetaData * md);
 
 /**
  * Suggest a better filename for a file (and do the

Modified: GNUnet/src/include/gnunet_identity_service.h
===================================================================
--- GNUnet/src/include/gnunet_identity_service.h        2005-07-06 18:18:38 UTC 
(rev 1292)
+++ GNUnet/src/include/gnunet_identity_service.h        2005-07-06 20:35:30 UTC 
(rev 1293)
@@ -135,13 +135,11 @@
    * @param hostId the host id
    * @param protocol the protocol that we need,
    *        ANY_PROTOCOL_NUMBER  if we do not care which protocol
-   * @param result where to store the result
-   * @return SYSERR on failure, OK on success
+   * @return NULL on failure, the HELO on success
    */
-  int (*identity2Helo)(const PeerIdentity *  hostId,
-                      unsigned short protocol,
-                      int tryTemporaryList,
-                      HELO_Message ** result);
+  HELO_Message * (*identity2Helo)(const PeerIdentity *  hostId,
+                                 unsigned short protocol,
+                                 int tryTemporaryList);
 
   /**
    *

Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h       2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/include/gnunet_transport.h       2005-07-06 20:35:30 UTC (rev 
1293)
@@ -237,7 +237,8 @@
    *        or the HELO_message from connect)
    * @param msg the message
    * @param size the size of the message, <= mtu
-   * @return SYSERR on error, OK on success; after any error,
+   * @return SYSERR on error, NO on temporary error (retry),
+   *         YES/OK on success; after any persistent error,
    *         the caller must call "disconnect" and not continue
    *         using the session afterwards (useful if the other
    *         side closed the connection).

Modified: GNUnet/src/include/gnunet_transport_service.h
===================================================================
--- GNUnet/src/include/gnunet_transport_service.h       2005-07-06 18:18:38 UTC 
(rev 1292)
+++ GNUnet/src/include/gnunet_transport_service.h       2005-07-06 20:35:30 UTC 
(rev 1293)
@@ -119,7 +119,8 @@
    * @param session the session identifying the connection
    * @param msg the message to send
    * @param size the size of the message
-   * @return OK on success, SYSERR on error
+   * @return OK on success, SYSERR on persistent error, NO on
+   *         temporary error
    */
   int (*send)(TSession * session,
              const void * msg,

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/src/server/connection.c      2005-07-06 20:35:30 UTC (rev 1293)
@@ -299,6 +299,8 @@
   /** argument to callback, call FREENONNULL(closure) if we
       can not transmit this MessagePart. */
   void * closure;
+  /** YES if selected by knapsack for sending */
+  int knapsackSolution;
 } SendEntry;
 
 /**
@@ -407,6 +409,9 @@
   /* what is the limit that we are currently shooting for? (byte per minute) */
   unsigned int idealized_limit;
 
+  /* are we currently in "sendBuffer" for this
+     entry? */
+  int inSendBuffer;
 } BufferEntry;
 
 typedef struct {
@@ -542,6 +547,8 @@
     = 0; /* never */
   be->MAX_SEND_FREQUENCY
     = 50 * cronMILLIS * getCPULoad();
+  be->inSendBuffer
+    = NO;
   cronTime(&be->last_bps_update); /* now */
   return be;
 }
@@ -596,13 +603,11 @@
  *
  * @param be the send buffer that is scheduled
  * @param available what is the maximum length available?
- * @param solution int[count] to store the solution as "YES" and "NO" values
  * @return the overall priority that was achieved
  */
 static unsigned int
 approximateKnapsack(BufferEntry * be,
-                   unsigned int available,
-                   int * solution) {
+                   unsigned int available) {
   unsigned int i;
   unsigned int count;
   SendEntry ** entries;
@@ -616,11 +621,11 @@
 
   for (i=0;i<count;i++) {
     if (entries[i]->len <= left) {
-      solution[i] = YES;
+      entries[i]->knapsackSolution = YES;
       left -= entries[i]->len;
       max += entries[i]->pri;
     } else {
-      solution[i] = NO;
+      entries[i]->knapsackSolution = NO;
     }
   }
   return max;
@@ -637,13 +642,11 @@
  *
  * @param be the send buffer that is scheduled
  * @param available what is the maximum length available?
- * @param solution int[count] to store the solution as "YES" and "NO" values
  * @return the overall priority that was achieved
  */
 static unsigned int
 solveKnapsack(BufferEntry * be,
-             unsigned int available,
-             int * solution) {
+             unsigned int available) {
   unsigned int i;
   int j;
   int max;
@@ -671,7 +674,7 @@
   if (max <= available) {
     /* short cut: take everything! */
     for (i=0;i<count;i++)
-      solution[i] = YES;
+      entries[i]->knapsackSolution = YES;
     max = 0;
     for (i=0;i<count;i++)
       max += entries[i]->pri;
@@ -743,12 +746,12 @@
 
   /* reconstruct selection */
   for (i=0;i<count;i++)
-    solution[i] = NO;
+    entries[i]->knapsackSolution = NO;
   for (i=count;i>0;i--) {
     if (j >= efflen[i-1]) {
       if (VARR(i-1, j-efflen[i-1]) + entries[i-1]->pri == VARR(i,j)) {
        j -= efflen[i-1];
-       solution[i-1] = YES;
+       entries[i-1]->knapsackSolution = YES;
       }
     }
   }
@@ -839,7 +842,6 @@
   SendCallbackList * pos;
   P2P_Message * p2pHdr;
   int priority;
-  int * knapsackSolution;
   int * perm;
   char * plaintextMsg;
   void * encryptedMsg;
@@ -849,6 +851,7 @@
   int approxProb;
   int remainingBufferSize;
   unsigned int totalMessageSize;
+  int ret;
 
   ENTRY();
   /* fast ways out */
@@ -861,6 +864,10 @@
   if (be->sendBufferSize == 0)
     return; /* nothing to send */
 
+  if (be->inSendBuffer == YES)
+    return; /* must not recurse! */
+  be->inSendBuffer = YES;
+
   /* recompute max send frequency */
   if (be->max_bpm <= 0)
     be->max_bpm = 1;
@@ -887,6 +894,7 @@
     LOG(LOG_DEBUG,
        "Send frequency too high (CPU load), send deferred.\n");
 #endif
+    be->inSendBuffer = NO;
     return; /* frequency too high, wait */
   }
 
@@ -905,17 +913,17 @@
 
     entries = be->sendBuffer;
     totalMessageSize = sizeof(P2P_Message);
-    knapsackSolution = MALLOC(sizeof(int) * be->sendBufferSize);
     priority = 0;
     i = 0;
     /* assumes entries are sorted by priority! */
     while (i < be->sendBufferSize) {
       if ( (totalMessageSize + entries[i]->len < MAX_BUFFER_SIZE) &&
           (entries[i]->pri >= EXTREME_PRIORITY) ) {
-       knapsackSolution[i] = YES;
+       entries[i]->knapsackSolution = YES;
        priority += entries[i]->pri;
        totalMessageSize += entries[i]->len;
       } else {
+       entries[i]->knapsackSolution = NO;
        break;
       }
       i++;
@@ -925,17 +933,17 @@
       if ( (entries[i]->len + totalMessageSize <=
            be->available_send_window) &&
           (totalMessageSize + entries[i]->len < MAX_BUFFER_SIZE) ) {
-       knapsackSolution[i] = YES;
+       entries[i]->knapsackSolution = YES;
        totalMessageSize += entries[i]->len;
        priority += entries[i]->pri;
       } else {
-       knapsackSolution[i] = NO;
+       entries[i]->knapsackSolution = NO;
        if (totalMessageSize == sizeof(P2P_Message)) {  
          /* if the highest-priority message does not yet
             fit, wait for send window to grow so that
             we can get it out (otherwise we would starve
             high-priority, large messages) */
-         FREE(knapsackSolution);
+         be->inSendBuffer = NO;    
          return;
        }
       }
@@ -947,13 +955,11 @@
           (randomi(16) != 0) ) ) {
       /* randomization necessary to ensure we eventually send
         the message if there is nothing else to do! */
-      FREE(knapsackSolution);
+      be->inSendBuffer = NO;
       return;
     }
   } else { /* if (be->session.mtu == 0) */
     /* solve knapsack problem, compute accumulated priority */
-    knapsackSolution = MALLOC(sizeof(int) * be->sendBufferSize);
-
     approxProb = getCPULoad();
     if (approxProb > 50) {
       if (approxProb > 100)
@@ -963,30 +969,27 @@
       /* control CPU load probabilistically! */
       if (randomi(1+approxProb) == 0) {
        priority = approximateKnapsack(be,
-                                      be->session.mtu - sizeof(P2P_Message),
-                                      knapsackSolution);
+                                      be->session.mtu - sizeof(P2P_Message));
 #if DEBUG_COLLECT_PRIO == YES
        FPRINTF(prioFile, "%llu 0 %d\n", cronTime(NULL), priority);
 #endif
       } else {
        priority = solveKnapsack(be,
-                                be->session.mtu - sizeof(P2P_Message),
-                                knapsackSolution);
+                                be->session.mtu - sizeof(P2P_Message));
 #if DEBUG_COLLECT_PRIO == YES
        FPRINTF(prioFile, "%llu 1 %d\n", cronTime(NULL), priority);
 #endif
       }
     } else { /* never approximate < 50% CPU load */
       priority = solveKnapsack(be,
-                              be->session.mtu - sizeof(P2P_Message),
-                              knapsackSolution);
+                              be->session.mtu - sizeof(P2P_Message));
 #if DEBUG_COLLECT_PRIO == YES
       FPRINTF(prioFile, "%llu 2 %d\n", cronTime(NULL), priority);
 #endif
     }
     j = 0;
     for (i=0;i<be->sendBufferSize;i++)
-      if (knapsackSolution[i] == YES)
+      if (be->sendBuffer[i]->knapsackSolution == YES)
        j++;
     if (j == 0) {
       LOG(LOG_ERROR,
@@ -1002,7 +1005,7 @@
            j,
            be->sendBuffer[j]->len,
            be->sendBuffer[j]->pri);
-      FREE(knapsackSolution);
+      be->inSendBuffer = NO;
       return;
     }
 
@@ -1011,12 +1014,12 @@
         want to ignore bandwidth availability (e.g. for HANGUP,
         which  has EXTREME_PRIORITY) */
       if (priority < EXTREME_PRIORITY) {
-       FREE(knapsackSolution);
 #if DEBUG_CONNECTION
        LOG(LOG_DEBUG,
            "bandwidth limits prevent sending (send window %u too small).\n",
            be->available_send_window);
 #endif
+       be->inSendBuffer = NO;
        return; /* can not send, BPS available is too small */
       }
     }
@@ -1029,7 +1032,7 @@
   /* check if we (sender) have enough bandwidth available */
   if (SYSERR == outgoingCheck(priority)) {
     int msgCap;
-    FREE(knapsackSolution);
+
     cronTime(&be->lastSendAttempt);
 #if DEBUG_CONNECTION
     LOG(LOG_DEBUG,
@@ -1047,6 +1050,7 @@
     /* allow at least msgCap msgs in buffer */
     for (i=0;i<be->sendBufferSize;i++) {       
       SendEntry * entry = be->sendBuffer[i];
+
       if (be->sendBufferSize <= msgCap)
        break;
       if ( entry->transmissionTime < expired) {
@@ -1069,6 +1073,7 @@
        i--; /* go again for this slot */
       }
     }
+    be->inSendBuffer = NO;
     return; /* deferr further */
   }
 
@@ -1089,8 +1094,8 @@
   headpos = 0;
   tailpos = be->sendBufferSize-1;
   remainingBufferSize = be->sendBufferSize;
-  for (i=0;i<be->sendBufferSize;i++)
-    if (knapsackSolution[perm[i]] == YES) {
+  for (i=0;i<be->sendBufferSize;i++) {
+    if (be->sendBuffer[perm[i]]->knapsackSolution == YES) {
       remainingBufferSize--;
       switch (be->sendBuffer[perm[i]]->flags & SE_PLACEMENT_FLAG) {
       case SE_FLAG_NONE:
@@ -1108,44 +1113,40 @@
        perm[i] = j;
       }
     }
+  }
 
   for (i=0;i<be->sendBufferSize;i++) {
     SendEntry * entry = be->sendBuffer[perm[i]];
-    if (knapsackSolution[perm[i]] == YES) {
-      int ret;
-
+    if (entry->knapsackSolution == YES) {
       if (entry->callback == NULL) {
        memcpy(&plaintextMsg[p],
               entry->closure,
               entry->len);
-       ret = OK;
       } else { 
-       ret = entry->callback(&plaintextMsg[p],
-                             entry->closure,
-                             entry->len);
-       if (ret == OK) {
+       if (OK == entry->callback(&plaintextMsg[p],
+                                 entry->closure,
+                                 entry->len)) {
          entry->callback = NULL;
          entry->closure = MALLOC(entry->len);
          memcpy(entry->closure,
                 &plaintextMsg[p],
                 entry->len);
+       } else {
+         /* should not happen if everything went well,
+            add random padding instead */
+         p2p_HEADER * part;
+         
+         part = (p2p_HEADER *) &plaintextMsg[p];
+         part->size
+           = htons(entry->len);
+         part->type
+           = htons(p2p_PROTO_NOISE);
+         for (i=p+sizeof(p2p_HEADER);i<entry->len+p;i++)
+           plaintextMsg[p] = (char) rand();
+         entry->callback = NULL;
+         entry->closure = NULL;
        }
       }
-      if (ret == SYSERR) {     
-       /* should not happen if everything went well,
-          add random padding instead */
-       p2p_HEADER * part;
-
-       part = (p2p_HEADER *) &plaintextMsg[p];
-       part->size
-         = htons(entry->len);
-       part->type
-         = htons(p2p_PROTO_NOISE);
-       for (i=p+sizeof(p2p_HEADER);i<entry->len+p;i++)
-         plaintextMsg[p] = (char) rand();
-       entry->callback = NULL;
-       entry->closure = NULL;
-      }
       p += entry->len;
     } else {
       int msgCap;
@@ -1219,13 +1220,23 @@
               &be->skey_local,
               (const INITVECTOR*) encryptedMsg, /* IV */
               &((P2P_Message*)encryptedMsg)->sequenceNumber);
-  if (! ( (SYSERR == transport->send(be->session.tsession,
-                                    encryptedMsg,
-                                    p)) &&
-         ( (priority < EXTREME_PRIORITY) ||
-           (SYSERR == transport->sendReliable(be->session.tsession,
-                                              encryptedMsg,
-                                              p))) ) ) {
+  if (be->session.tsession == NULL)
+    be->session.tsession
+      = transport->connectFreely(&be->session.sender,
+                                YES);
+  if (be->session.tsession == NULL)
+    ret = SYSERR;
+  else
+    ret = transport->send(be->session.tsession,
+                         encryptedMsg,
+                         p);
+  if ( (ret == NO) &&
+       (priority >= EXTREME_PRIORITY) ) {
+    ret = transport->sendReliable(be->session.tsession,
+                                 encryptedMsg,
+                                 p);
+  }
+  if (ret == YES) {
     if (be->available_send_window > totalMessageSize)
       be->available_send_window -= totalMessageSize;
     else
@@ -1252,7 +1263,7 @@
     }
     for (i=0;i<be->sendBufferSize;i++) {
       SendEntry * entry = be->sendBuffer[i];
-      if (knapsackSolution[i] == YES) {
+      if (entry->knapsackSolution == YES) {
        GNUNET_ASSERT(entry->callback == NULL);
        FREENONNULL(entry->closure);
        FREE(entry);
@@ -1264,7 +1275,12 @@
       }      
     }
   }
-  FREE(knapsackSolution);
+  if ( (ret == SYSERR) &&
+       (be->session.tsession != NULL) ) {
+    transport->disconnect(be->session.tsession);
+    be->session.tsession = NULL;
+  }
+
   FREE(encryptedMsg);
   FREE(plaintextMsg);
 
@@ -1276,6 +1292,7 @@
   GROW(be->sendBuffer,
        be->sendBufferSize,
        j);
+  be->inSendBuffer = NO;
 }
 
 /**
@@ -2335,9 +2352,10 @@
         to get to know each other). See also transport paper and the
         data on throughput. - CG
       */
-      if (transport->getCost(tsession->ttype) >= cost) {
+      if (transport->getCost(tsession->ttype) < cost) {
        if (transport->associate(tsession) == OK) {
-         transport->disconnect(be->session.tsession);
+         if (be->session.tsession != NULL)
+           transport->disconnect(be->session.tsession);
          be->session.tsession = tsession;
          be->session.mtu = transport->getMTU(tsession->ttype);
        }
@@ -2698,7 +2716,7 @@
  *
  * @param session the transport session
  * @param msg the message to transmit, should contain p2p_HEADERs
- * @return OK on success, SYSERR on failure
+ * @return OK on success, SYSERR on failure, NO on temporary failure
  */
 int sendPlaintext(TSession * tsession,
                  const char * msg,

Modified: GNUnet/src/server/gnunet-peer-info.c
===================================================================
--- GNUnet/src/server/gnunet-peer-info.c        2005-07-06 18:18:38 UTC (rev 
1292)
+++ GNUnet/src/server/gnunet-peer-info.c        2005-07-06 20:35:30 UTC (rev 
1293)
@@ -136,10 +136,10 @@
 
   hash2enc(&id->hashPubKey,
           &enc);
-  if (SYSERR == identity->identity2Helo(id,
-                                       proto,
-                                       NO,
-                                       &helo)) {
+  helo = identity->identity2Helo(id,
+                                proto,
+                                NO);
+  if (NULL == helo) {
     LOG(LOG_WARNING,
        _("Could not get address of peer '%s'.\n"),
        &enc);

Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c        2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/src/transports/http.c        2005-07-06 20:35:30 UTC (rev 1293)
@@ -932,8 +932,8 @@
  * @param doPost should an HTTP post prefix be created?
  * @param mp the message to send
  * @param ssize the size of the message
- * @return OK if message send or queued, SYSERR if queue is full and
- * message was dropped.
+ * @return OK if message send or queued, NO if queue is full and
+ * message was dropped, SYSERR on error
  */
 static int httpDirectSend(HTTPSession * httpSession,
                          int doPost,
@@ -959,7 +959,7 @@
   MUTEX_LOCK(&httplock);
   if (httpSession->wpos > 0) {
     MUTEX_UNLOCK(&httplock);
-    return SYSERR; /* already have msg pending */
+    return NO; /* already have msg pending */
   }
   if (doPost == YES) {
     IPaddr ip;
@@ -1234,7 +1234,7 @@
  * @param tsession the HELO_Message identifying the remote node
  * @param msg the message
  * @param size the size of the message
- * @return SYSERR on error, OK on success
+ * @return SYSERR on error, OK on success, NO if queue is full
  */
 static int httpSend(TSession * tsession,
                    const void * msg,

Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/src/transports/tcp.c 2005-07-06 20:35:30 UTC (rev 1293)
@@ -813,8 +813,8 @@
  * @param tcpSession the session to use for sending
  * @param mp the message to send
  * @param ssize the size of the message
- * @return OK if message send or queued, SYSERR if queue is full and
- * message was dropped.
+ * @return OK if message send or queued, NO if queue is full and
+ * message was dropped, SYSERR on error
  */
 static int tcpDirectSend(TCPSession * tcpSession,
                         void * mp,
@@ -856,7 +856,7 @@
       stats->change(stat_bytesDropped,
                    ssize);
     MUTEX_UNLOCK(&tcplock);
-    return SYSERR;
+    return NO;
   }
 #if DEBUG_TCP
   LOG(LOG_DEBUG,
@@ -911,8 +911,8 @@
  * @param tcpSession the session to use for sending
  * @param mp the message to send
  * @param ssize the size of the message
- * @return OK if message send or queued, SYSERR if queue is full and
- * message was dropped.
+ * @return OK if message send or queued, NO if queue is full and
+ * message was dropped, SYSERR on error
  */
 static int tcpDirectSendReliable(TCPSession * tcpSession,
                                 void * mp,
@@ -975,7 +975,7 @@
  * @param tsession the HELO_Message identifying the remote node
  * @param msg the message
  * @param size the size of the message
- * @return SYSERR on error, OK on success
+ * @return SYSERR on error, OK on success, NO on temporary error
  */
 static int tcpSendReliable(TSession * tsession,
                           const void * msg,

Modified: GNUnet/src/transports/tcp6.c
===================================================================
--- GNUnet/src/transports/tcp6.c        2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/src/transports/tcp6.c        2005-07-06 20:35:30 UTC (rev 1293)
@@ -764,8 +764,8 @@
  * @param tcp6Session the session to use for sending
  * @param mp the message to send
  * @param ssize the size of the message
- * @return OK if message send or queued, SYSERR if queue is full and
- * message was dropped.
+ * @return OK if message send or queued, NO if queue is full and
+ * message was dropped, SYSERR on error
  */
 static int tcp6DirectSend(TCP6Session * tcp6Session,
                          void * mp,
@@ -789,7 +789,7 @@
   MUTEX_LOCK(&tcp6lock);
   if (tcp6Session->wpos > 0) {
     MUTEX_UNLOCK(&tcp6lock);
-    return SYSERR;
+    return NO;
   }
   success = SEND_NONBLOCKING(tcp6Session->sock,
                             mp,
@@ -829,8 +829,8 @@
  * @param tcp6Session the session to use for sending
  * @param mp the message to send
  * @param ssize the size of the message
- * @return OK if message send or queued, SYSERR if queue is full and
- * message was dropped.
+ * @return OK if message send or queued, NO if queue is full and
+ * message was dropped, SYSERR on error
  */
 static int tcp6DirectSendReliable(TCP6Session * tcp6Session,
                                  void * mp,
@@ -875,7 +875,7 @@
  * @param tsession the HELO_Message identifying the remote node
  * @param msg the message
  * @param size the size of the message
- * @return SYSERR on error, OK on success
+ * @return SYSERR on error, OK on success, NO if queue is full
  */
 static int tcp6SendReliable(TSession * tsession,
                           const void * msg,

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-07-06 18:18:38 UTC (rev 1292)
+++ GNUnet/todo 2005-07-06 20:35:30 UTC (rev 1293)
@@ -4,14 +4,6 @@
     (pre3 has been observed to connect to just 1 peer,
      whilst gnunet-transport-check -p was able to
      connect to 4-6 peers at the same time!) [ everybody! ]
-- tcpSend (transport send in general) should be able
-  to differenciate between temporary failure (blocking)
-  and persistent failure (closed connection); that way,
-  the core can either decide to open a new connection
-  or drop all of the messages, instead of continuing
-  to hammer tcpSend as it is now; core should probably
-  keep a retry-counter (retry to re-open session X
-  times), and if it failes X times close the session! [ CG ]
 - Do well-behaved peers go over bandwidth limits?
   (Nils reported about strict blacklisting!)
 - cleanup API a bit more [ CG ]





reply via email to

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