gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r28150 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r28150 - gnunet/src/fs
Date: Thu, 18 Jul 2013 13:50:11 +0200

Author: grothoff
Date: 2013-07-18 13:50:11 +0200 (Thu, 18 Jul 2013)
New Revision: 28150

Modified:
   gnunet/src/fs/gnunet-service-fs_mesh_client.c
   gnunet/src/fs/gnunet-service-fs_mesh_server.c
Log:
-sync for bart

Modified: gnunet/src/fs/gnunet-service-fs_mesh_client.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-07-18 11:49:04 UTC 
(rev 28149)
+++ gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-07-18 11:50:11 UTC 
(rev 28150)
@@ -155,7 +155,7 @@
 /**
  * Mesh tunnel for creating outbound tunnels.
  */
-static struct GNUNET_MESH_Handle *mesh_tunnel;
+static struct GNUNET_MESH_Handle *mesh_handle;
 
 /**
  * Map from peer identities to 'struct MeshHandles' with mesh
@@ -216,16 +216,16 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Resetting mesh tunnel to %s\n",
              GNUNET_i2s (&mh->target));
-  GNUNET_MESH_tunnel_destroy (mh->tunnel);
+  GNUNET_mesh_handle_destroy (mh->tunnel);
   GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
                                         &move_to_pending,
                                         mh);
-  mh->tunnel = GNUNET_MESH_tunnel_create (mesh_tunnel,
-                                       mh,
-                                       &mh->target,
-                                       
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
-                                       GNUNET_YES,
-                                       GNUNET_YES);
+  mh->tunnel = GNUNET_mesh_handle_create (mesh_handle,
+                                         mh,
+                                         &mh->target,
+                                         
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
+                                         GNUNET_YES,
+                                         GNUNET_YES);
 }
 
 
@@ -240,7 +240,7 @@
              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct MeshHandle *mh = cls;
-  struct GNUNET_MESH_Tunnel *tun;
+  struct GNUNET_Mesh_Handle *tun;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Timeout on mesh tunnel to %s\n",
@@ -248,7 +248,7 @@
   mh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
   tun = mh->tunnel;
   mh->tunnel = NULL;
-  GNUNET_MESH_tunnel_destroy (tun);
+  GNUNET_mesh_handle_destroy (tun);
 }
 
 
@@ -306,6 +306,9 @@
   mh->wh = NULL;
   if (NULL == buf)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Mesh tunnel to %s failed during transmission attempt, 
rebuilding\n",
+               GNUNET_i2s (&mh->target));
     reset_mesh (mh);
     return 0;
   }
@@ -430,7 +433,7 @@
  */
 static int
 reply_cb (void *cls,
-         struct GNUNET_MESH_Tunnel *tunnel,
+         struct GNUNET_Mesh_Handle *tunnel,
          void **tunnel_ctx,
           const struct GNUNET_MessageHeader *message)
 {
@@ -464,6 +467,7 @@
              "Received reply `%s' via mesh from peer %s\n",
              GNUNET_h2s (&query),
              GNUNET_i2s (&mh->target));
+  GNUNET_MESH_receive_done (tunnel);
   GNUNET_STATISTICS_update (GSF_stats,
                            gettext_noop ("# replies received via mesh"), 1,
                            GNUNET_NO);
@@ -517,12 +521,12 @@
                                                 mh);
   mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES);
   mh->target = *target;
-  mh->tunnel = GNUNET_MESH_tunnel_create (mesh_tunnel,
-                                       mh,
-                                       &mh->target,
-                                       
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
-                                       GNUNET_NO,
-                                       GNUNET_YES);
+  mh->tunnel = GNUNET_mesh_handle_create (mesh_handle,
+                                         mh,
+                                         &mh->target,
+                                         
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
+                                         GNUNET_NO,
+                                         GNUNET_YES);
   GNUNET_assert (GNUNET_OK ==
                 GNUNET_CONTAINER_multihashmap_put (mesh_map,
                                                    &mh->target.hashPubKey,
@@ -638,7 +642,7 @@
  */
 static void
 cleaner_cb (void *cls,
-           const struct GNUNET_MESH_Tunnel *tunnel,
+           const struct GNUNET_Mesh_Handle *tunnel,
            void *tunnel_ctx)
 {
   struct MeshHandle *mh = tunnel_ctx;
@@ -680,18 +684,14 @@
     { &reply_cb, GNUNET_MESSAGE_TYPE_FS_MESH_REPLY, 0 },
     { NULL, 0, 0 }
   };
-  static const uint32_t ports[] = {
-    GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
-    0
-  };
 
   mesh_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES);
-  mesh_tunnel = GNUNET_MESH_connect (GSF_cfg,
-                                        NULL,
-                                        NULL,
-                                        &cleaner_cb,
-                                        handlers,
-                                        ports);
+  mesh_handle = GNUNET_MESH_connect (GSF_cfg,
+                                    NULL,
+                                    NULL,
+                                    &cleaner_cb,
+                                    handlers,
+                                    NULL);
 }
 
 
@@ -709,7 +709,7 @@
               void *value)
 {
   struct MeshHandle *mh = value;
-  struct GNUNET_MESH_Tunnel *tun;
+  struct GNUNET_Mesh_Handle *tun;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Timeout on mesh tunnel to %s\n",
@@ -717,7 +717,7 @@
   tun = mh->tunnel;
   mh->tunnel = NULL;
   if (NULL != tun)
-    GNUNET_MESH_tunnel_destroy (tun);
+    GNUNET_mesh_handle_destroy (tun);
   return GNUNET_YES;
 }
 
@@ -733,10 +733,10 @@
                                         NULL);
   GNUNET_CONTAINER_multihashmap_destroy (mesh_map);
   mesh_map = NULL;
-  if (NULL != mesh_tunnel)
+  if (NULL != mesh_handle)
   {
-    GNUNET_MESH_disconnect (mesh_tunnel);
-    mesh_tunnel = NULL;
+    GNUNET_MESH_disconnect (mesh_handle);
+    mesh_handle = NULL;
   }
 }
 

Modified: gnunet/src/fs/gnunet-service-fs_mesh_server.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh_server.c       2013-07-18 11:49:04 UTC 
(rev 28149)
+++ gnunet/src/fs/gnunet-service-fs_mesh_server.c       2013-07-18 11:50:11 UTC 
(rev 28150)
@@ -544,6 +544,9 @@
                                             "MAX_MESH_CLIENTS",
                                             &sc_count_max))
     return;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Initializing mesh FS server with a limit of %llu connections\n",
+             sc_count_max);
   listen_tunnel = GNUNET_MESH_connect (GSF_cfg,
                                       NULL,
                                       &accept_cb,




reply via email to

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