gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1115 - in GNUnet: po src/applications/fs/fsui src/applicat


From: grothoff
Subject: [GNUnet-SVN] r1115 - in GNUnet: po src/applications/fs/fsui src/applications/fs/module src/server
Date: Tue, 28 Jun 2005 12:43:31 -0700 (PDT)

Author: grothoff
Date: 2005-06-28 12:43:22 -0700 (Tue, 28 Jun 2005)
New Revision: 1115

Modified:
   GNUnet/po/de.po
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/fs/fsui/fsui.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/fs/module/migration.c
   GNUnet/src/applications/fs/module/migration.h
   GNUnet/src/server/connection.c
Log:
fixes

Modified: GNUnet/po/de.po
===================================================================
--- GNUnet/po/de.po     2005-06-28 19:31:58 UTC (rev 1114)
+++ GNUnet/po/de.po     2005-06-28 19:43:22 UTC (rev 1115)
@@ -3201,10 +3201,10 @@
 "Empfangene Nachricht ist mehr als ein Tag alt. Nachricht wird verworfen.\n"
 
 #: src/server/connection.c:2122
-msgid "Session confirmed, but cannot connect! (bug?)"
+msgid "Session confirmed, but cannot connect! (bug?)\n"
 msgstr ""
 "Sitzung ist best�tigt, es kann jedoch keine Verbindung hergestellt werden! "
-"(Bug?)"
+"(Bug?)\n"
 
 #: src/server/startup.c:123
 #, c-format

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2005-06-28 19:31:58 UTC (rev 
1114)
+++ GNUnet/src/applications/fs/fsui/download.c  2005-06-28 19:43:22 UTC (rev 
1115)
@@ -467,14 +467,15 @@
   FSUI_DownloadList * dl;
   unsigned int backup;
 
-  /* FIXME: check that filename matches
-     aborted download! */
   GNUNET_ASSERT(filename != NULL);
   MUTEX_LOCK(&ctx->lock);
   dl = ctx->activeDownloads.child;
   while (dl != NULL) {
-    if (ECRS_equalsUri(uri,
-                      dl->uri)) {
+    if ( (ECRS_equalsUri(uri,
+                      dl->uri)) &&
+        ( (filename == NULL) ||
+          (0 == strcmp(filename,
+                       dl->filename)) ) ) {
       backup = ctx->threadPoolSize;
       ctx->threadPoolSize = 0;
       updateDownloadThread(dl);

Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c      2005-06-28 19:31:58 UTC (rev 
1114)
+++ GNUnet/src/applications/fs/fsui/fsui.c      2005-06-28 19:43:22 UTC (rev 
1115)
@@ -80,6 +80,7 @@
   unsigned int big;
   unsigned long long bigl;
   int i;
+  int ok;
 
   GNUNET_ASSERT(ctx != NULL);
   if (1 != READ(fd, &zaro, sizeof(char))) {
@@ -91,6 +92,9 @@
   LOG(LOG_DEBUG,
       "FSUI persistence: restoring download\n");
   ret = MALLOC(sizeof(FSUI_DownloadList));
+  memset(ret, 
+        0,
+        sizeof(FSUI_DownloadList));
   ret->ctx = ctx;
 
   ret->signalTerminate 
@@ -107,7 +111,6 @@
   }
   ret->filename = MALLOC(big+1);
   if (big != READ(fd, ret->filename, big)) {
-    FREE(ret->filename);
     BREAK();
     goto ERR;
   }
@@ -125,12 +128,17 @@
   else
     ret->completedDownloads
       = NULL;
+  ok = ret->uri != NULL;
   for (i=0;i<ret->completedDownloadsCount;i++) {
     ret->completedDownloads[i]
       = readURI(fd);
+    if (ret->completedDownloads[i] == NULL) 
+      ok = NO;
   }
-  /* FIXME: check if URIs were
-     all read successfully! */
+  if (NO == ok) {
+    BREAK();
+    goto ERR;
+  }
   ret->parent = parent;
   ret->signalTerminate = SYSERR;
   ret->next = readDownloadList(fd,
@@ -141,6 +149,14 @@
                                ret);
   return ret;
  ERR:
+  FREENONNULL(ret->filename);
+  if (ret->uri != NULL)
+    ECRS_freeUri(ret->uri);
+  for (i=0;i<ret->completedDownloadsCount;i++) {
+    if (ret->completedDownloads[i] != NULL)
+      ECRS_freeUri(ret->completedDownloads);
+
+  
   FREE(ret);
   LOG(LOG_WARNING,
       _("FSUI persistence: error restoring download\n"));

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2005-06-28 19:31:58 UTC (rev 
1114)
+++ GNUnet/src/applications/fs/module/fs.c      2005-06-28 19:43:22 UTC (rev 
1115)
@@ -1067,7 +1067,11 @@
                                                      
&csHandleRequestTestIndexed));
   GNUNET_ASSERT(SYSERR != 
capi->registerClientHandler(AFS_CS_PROTO_GET_AVG_PRIORITY,
                                                      
&csHandleRequestGetAvgPriority));
-  initMigration(capi, datastore, gap, dht);
+  initMigration(capi, 
+               datastore, 
+               gap, 
+               dht,
+               traffic);
   return OK;
 }
 

Modified: GNUnet/src/applications/fs/module/migration.c
===================================================================
--- GNUnet/src/applications/fs/module/migration.c       2005-06-28 19:31:58 UTC 
(rev 1114)
+++ GNUnet/src/applications/fs/module/migration.c       2005-06-28 19:43:22 UTC 
(rev 1115)
@@ -49,6 +49,10 @@
  */
 static DHT_ServiceAPI * dht;
 
+/**
+ * Traffic service.
+ */
+static Traffic_ServiceAPI * traffic;
                                
 /**
  * Callback method for pushing content into the network.
@@ -76,6 +80,7 @@
   unsigned int size;
   cron_t et;
   cron_t now;
+  unsigned int anonymity;
 
   ret = 0;
   if (OK == datastore->getRandom(&receiver->hashPubKey,
@@ -84,8 +89,6 @@
                                 &content,
                                 0)) {
     size = sizeof(GapWrapper) + ntohl(content->size) - sizeof(Datastore_Value);
-    gw = MALLOC(size);
-    gw->dc.size = htonl(size);
     et = ntohll(content->expirationTime);
     cronTime(&now);
     if (et > now) {
@@ -93,20 +96,34 @@
       et = et % MAX_MIGRATION_EXP;
       et += now;
     }
-    gw->timeout = htonll(et);
-    memcpy(&gw[1],
-          &content[1],
-          size - sizeof(GapWrapper));
-    /* FIXME: check anonymity level,
-       if 0, consider using DHT migration instead;
-       if high, consider traffic volume before
-       migrating */
+    anonymity = ntohl(content->anonymityLevel);
+    ret = SYSERR;
+    if (anonymity == 0) {
+      /* ret = OK; */
+    } 
+    if ( (ret != OK) &&
+        (traffic != NULL) ) {
+      gw = MALLOC(size);
+      gw->dc.size = htonl(size);
+      gw->timeout = htonll(et);
+      memcpy(&gw[1],
+            &content[1],
+            size - sizeof(GapWrapper));
+
+      
+      
+    
+      /* FIXME: check anonymity level,
+        if 0, consider using DHT migration instead;
+        if high, consider traffic volume before
+        migrating */
+      ret = gap->tryMigrate(&gw->dc,
+                           &key,
+                           position,
+                           padding);
+      FREE(gw);
+    }
     FREE(content);
-    ret = gap->tryMigrate(&gw->dc,
-                         &key,
-                         position,
-                         padding);
-    FREE(gw);
   }
   return ret;
 }
@@ -114,11 +131,13 @@
 void initMigration(CoreAPIForApplication * capi,
                   Datastore_ServiceAPI * ds,
                   GAP_ServiceAPI * g,
-                  DHT_ServiceAPI * d) {
+                  DHT_ServiceAPI * d,
+                  Traffic_ServiceAPI * t) {
   coreAPI = capi;
   datastore = ds;
   gap = g;
   dht = d;
+  traffic = t;
   coreAPI->registerSendCallback(512,
                                (BufferFillCallback)&activeMigrationCallback);
 }
@@ -130,6 +149,7 @@
   gap = NULL;
   dht = NULL;
   coreAPI = NULL;
+  traffic = NULL;
 }
 
 /* end of migration.c */

Modified: GNUnet/src/applications/fs/module/migration.h
===================================================================
--- GNUnet/src/applications/fs/module/migration.h       2005-06-28 19:31:58 UTC 
(rev 1114)
+++ GNUnet/src/applications/fs/module/migration.h       2005-06-28 19:43:22 UTC 
(rev 1115)
@@ -84,7 +84,8 @@
 void initMigration(CoreAPIForApplication * capi,
                   Datastore_ServiceAPI * s,
                   GAP_ServiceAPI * g,
-                  DHT_ServiceAPI * d);
+                  DHT_ServiceAPI * d,
+                  Traffic_ServiceAPI * t);
 
 void doneMigration();
 

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-06-28 19:31:58 UTC (rev 1114)
+++ GNUnet/src/server/connection.c      2005-06-28 19:43:22 UTC (rev 1115)
@@ -2121,7 +2121,7 @@
              = transport->getMTU(be->session.tsession->ttype); 
          } else {
            LOG(LOG_WARNING,
-               _("Session confirmed, but cannot connect! (bug?)"));
+               _("Session confirmed, but cannot connect! (bug?)\n"));
            FREE(helo);
          }
        }





reply via email to

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