gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30136 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r30136 - gnunet/src/mesh
Date: Fri, 11 Oct 2013 14:23:57 +0200

Author: bartpolot
Date: 2013-10-11 14:23:57 +0200 (Fri, 11 Oct 2013)
New Revision: 30136

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_connection.h
   gnunet/src/mesh/gnunet-service-mesh_peer.c
   gnunet/src/mesh/gnunet-service-mesh_peer.h
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- fixes in DHT handling


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-11 12:16:22 UTC 
(rev 30135)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-11 12:23:57 UTC 
(rev 30136)
@@ -568,7 +568,7 @@
   if (MESH_TUNNEL3_NEW == GMT_get_state (t))
     GMT_change_state (t, MESH_TUNNEL3_WAITING);
   if (MESH_CONNECTION_READY != connection->state)
-    GMC_change_state (connection, MESH_CONNECTION_SENT);
+    connection_change_state (connection, MESH_CONNECTION_SENT);
 }
 
 
@@ -613,7 +613,7 @@
 {
   LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n");
   if (fwd)
-    send_connection_create (c);
+    GMC_send_create (c);
   else
     send_connection_ack (c, GNUNET_NO);
 }
@@ -1679,7 +1679,7 @@
       GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_MSGS_QUEUE",
                                              &max_msgs_queue))
   {
-    LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+    GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
                                "MESH", "MAX_MSGS_QUEUE", "MISSING");
     GNUNET_SCHEDULER_shutdown ();
     return;
@@ -1689,7 +1689,7 @@
       GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_CONNECTIONS",
                                              &max_connections))
   {
-    LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+    GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
                                "MESH", "MAX_CONNECTIONS", "MISSING");
     GNUNET_SCHEDULER_shutdown ();
     return;
@@ -1699,7 +1699,7 @@
       GNUNET_CONFIGURATION_get_value_time (c, "MESH", 
"REFRESH_CONNECTION_TIME",
                                            &refresh_connection_time))
   {
-    LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+    GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
                                "MESH", "REFRESH_CONNECTION_TIME", "MISSING");
     GNUNET_SCHEDULER_shutdown ();
     return;
@@ -2105,7 +2105,7 @@
   if (MESH_TUNNEL3_SEARCHING == state || MESH_TUNNEL3_NEW == state)
     GMT_change_state (connection->t, MESH_TUNNEL3_WAITING);
   if (MESH_CONNECTION_NEW == connection->state)
-    GMC_change_state (connection, MESH_CONNECTION_SENT);
+    connection_change_state (connection, MESH_CONNECTION_SENT);
 }
 
 

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-10-11 12:16:22 UTC 
(rev 30135)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-10-11 12:23:57 UTC 
(rev 30136)
@@ -335,15 +335,6 @@
 
 
 /**
- * Change the tunnel state.
- *
- * @param c Connection whose state to change.
- * @param state New state.
- */
-void
-GMC_change_state (struct MeshConnection* c, enum MeshConnectionState state);
-
-/**
  * Notify other peers on a connection of a broken link. Mark connections
  * to destroy after all traffic has been sent.
  *

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-11 12:16:22 UTC (rev 
30135)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-11 12:23:57 UTC (rev 
30136)
@@ -247,13 +247,13 @@
 static void
 core_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
-  struct MeshPeer *pi;
+  struct MeshPeer *mp;
   struct MeshPeerPath *path;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer connected\n");
   LOG (GNUNET_ERROR_TYPE_DEBUG, "     %s\n", GNUNET_i2s (&my_full_id));
-  pi = GMP_get (peer);
-  if (myid == pi->id)
+  mp = GMP_get (peer);
+  if (myid == mp->id)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "     (self)\n");
     path = path_new (1);
@@ -262,15 +262,15 @@
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "     %s\n", GNUNET_i2s (peer));
     path = path_new (2);
-    path->peers[1] = pi->id;
-    GNUNET_PEER_change_rc (pi->id, 1);
+    path->peers[1] = mp->id;
+    GNUNET_PEER_change_rc (mp->id, 1);
     GNUNET_STATISTICS_update (stats, "# peers", 1, GNUNET_NO);
   }
   path->peers[0] = myid;
   GNUNET_PEER_change_rc (myid, 1);
-  peer_add_path (pi, path, GNUNET_YES);
+  GMP_add_path (mp, path, GNUNET_YES);
 
-  pi->connections = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES);
+  mp->connections = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES);
   return;
 }
 
@@ -1589,6 +1589,45 @@
 }
 
 /**
+ * Start the DHT search for new paths towards the peer: we don't have
+ * enough good connections.
+ *
+ * @param peer Destination peer.
+ */
+void
+GMP_start_search (struct MeshPeer *peer)
+{
+  if (NULL != peer->search_h)
+  {
+    GNUNET_break (0);
+    return;
+  }
+
+  peer->search_h = GMD_search (GMP_get_id (peer), &search_handler, peer);
+}
+
+
+/**
+ * Stop the DHT search for new paths towards the peer: we already have
+ * enough good connections.
+ *
+ * @param peer Destination peer.
+ */
+void
+GMP_stop_search (struct MeshPeer *peer)
+{
+  if (NULL == peer->search_h)
+  {
+    GNUNET_break (0);
+    return;
+  }
+
+  GMD_search_stop (peer->search_h);
+  peer->search_h = NULL;
+}
+
+
+/**
  * Get the Full ID of a peer.
  *
  * @param peer Peer to get from.

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.h  2013-10-11 12:16:22 UTC (rev 
30135)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.h  2013-10-11 12:23:57 UTC (rev 
30136)
@@ -237,9 +237,21 @@
 int
 GMP_remove_connection (struct MeshPeer *peer, const struct MeshConnection *c);
 
+/**
+ * Start the DHT search for new paths towards the peer: we don't have
+ * enough good connections.
+ *
+ * @param peer Destination peer.
+ */
 void
 GMP_start_search (struct MeshPeer *peer);
 
+/**
+ * Stop the DHT search for new paths towards the peer: we already have
+ * enough good connections.
+ *
+ * @param peer Destination peer.
+ */
 void
 GMP_stop_search (struct MeshPeer *peer);
 

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-11 12:16:22 UTC 
(rev 30135)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-11 12:23:57 UTC 
(rev 30136)
@@ -1179,10 +1179,10 @@
 int
 GMT_is_path_used (const struct MeshTunnel3 *t, const struct MeshPeerPath *p)
 {
-  struct MeshTConnection *c;
+  struct MeshTConnection *iter;
 
-  for (c = t->connection_head; NULL != c; c = c->next)
-    if (GMC_get_path (c) == p)
+  for (iter = t->connection_head; NULL != iter; iter = iter->next)
+    if (GMC_get_path (iter->c) == p)
       return GNUNET_YES;
 
   return GNUNET_NO;




reply via email to

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