[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31353 - in gnunet/src: dv include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31353 - in gnunet/src: dv include |
Date: |
Fri, 13 Dec 2013 13:48:34 +0100 |
Author: grothoff
Date: 2013-12-13 13:48:34 +0100 (Fri, 13 Dec 2013)
New Revision: 31353
Modified:
gnunet/src/dv/dv.h
gnunet/src/dv/dv_api.c
gnunet/src/dv/gnunet-dv.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/dv/plugin_transport_dv.c
gnunet/src/include/gnunet_dv_service.h
Log:
allow distance change to communicate changes in network of next hop as well,
related to #3191, but not sure if it fixes it
Modified: gnunet/src/dv/dv.h
===================================================================
--- gnunet/src/dv/dv.h 2013-12-13 12:40:18 UTC (rev 31352)
+++ gnunet/src/dv/dv.h 2013-12-13 12:48:34 UTC (rev 31353)
@@ -37,7 +37,7 @@
struct GNUNET_DV_ConnectMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_CONNECT
+ * Type: #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_CONNECT
*/
struct GNUNET_MessageHeader header;
@@ -47,14 +47,14 @@
uint32_t distance GNUNET_PACKED;
/**
- * The network the peer is in
+ * The other peer (at the given distance).
*/
- uint32_t network GNUNET_PACKED;
+ struct GNUNET_PeerIdentity peer;
/**
- * The other peer (at the given distance).
+ * The network the peer is in
*/
- struct GNUNET_PeerIdentity peer;
+ uint32_t network GNUNET_PACKED;
};
@@ -69,7 +69,7 @@
struct GNUNET_DV_DisconnectMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_DISCONNECT
+ * Type: #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_DISCONNECT
*/
struct GNUNET_MessageHeader header;
@@ -96,7 +96,7 @@
struct GNUNET_DV_ReceivedMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_RECV
+ * Type: #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_RECV
*/
struct GNUNET_MessageHeader header;
@@ -121,7 +121,7 @@
struct GNUNET_DV_SendMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_DV_SEND
+ * Type: #GNUNET_MESSAGE_TYPE_DV_SEND
*/
struct GNUNET_MessageHeader header;
@@ -145,8 +145,8 @@
struct GNUNET_DV_AckMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_DV_SEND_ACK or
- * GNUNET_MESSAGE_TYPE_DV_SEND_NACK.
+ * Type: #GNUNET_MESSAGE_TYPE_DV_SEND_ACK or
+ * #GNUNET_MESSAGE_TYPE_DV_SEND_NACK.
*/
struct GNUNET_MessageHeader header;
@@ -170,7 +170,7 @@
struct GNUNET_DV_DistanceUpdateMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED.
+ * Type: #GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED.
*/
struct GNUNET_MessageHeader header;
@@ -184,6 +184,11 @@
*/
struct GNUNET_PeerIdentity peer;
+ /**
+ * The network the peer is in
+ */
+ uint32_t network GNUNET_PACKED;
+
};
Modified: gnunet/src/dv/dv_api.c
===================================================================
--- gnunet/src/dv/dv_api.c 2013-12-13 12:40:18 UTC (rev 31352)
+++ gnunet/src/dv/dv_api.c 2013-12-13 12:48:34 UTC (rev 31353)
@@ -371,7 +371,8 @@
dum = (const struct GNUNET_DV_DistanceUpdateMessage *) msg;
sh->distance_cb (sh->cls,
&dum->peer,
- ntohl (dum->distance));
+ ntohl (dum->distance),
+ ntohl (dum->network));
break;
case GNUNET_MESSAGE_TYPE_DV_DISCONNECT:
if (ntohs (msg->size) != sizeof (struct GNUNET_DV_DisconnectMessage))
Modified: gnunet/src/dv/gnunet-dv.c
===================================================================
--- gnunet/src/dv/gnunet-dv.c 2013-12-13 12:40:18 UTC (rev 31352)
+++ gnunet/src/dv/gnunet-dv.c 2013-12-13 12:48:34 UTC (rev 31353)
@@ -62,11 +62,13 @@
* @param cls closure
* @param peer connected peer
* @param distance new distance to the peer
+ * @param network network used on first hop to peer
*/
static void
change_cb (void *cls,
const struct GNUNET_PeerIdentity *peer,
- uint32_t distance)
+ uint32_t distance,
+ uint32_t network)
{
fprintf (stderr, "Change: %s at %u\n",
GNUNET_i2s (peer),
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2013-12-13 12:40:18 UTC (rev 31352)
+++ gnunet/src/dv/gnunet-service-dv.c 2013-12-13 12:48:34 UTC (rev 31353)
@@ -512,10 +512,12 @@
*
* @param peer peer with a changed distance
* @param distance new distance to the peer
+ * @param network network used by the neighbor
*/
static void
send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer,
- uint32_t distance)
+ uint32_t distance,
+ uint32_t network)
{
struct GNUNET_DV_DistanceUpdateMessage du_msg;
@@ -526,6 +528,7 @@
du_msg.header.type = htons (GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED);
du_msg.distance = htonl (distance);
du_msg.peer = *peer;
+ du_msg.network = htonl (network);
send_control_to_plugin (&du_msg.header);
}
@@ -1045,7 +1048,8 @@
move_route (route, ntohl (target->distance) + 1);
route->next_hop = neighbor;
send_distance_change_to_plugin (&target->peer,
- ntohl (target->distance) + 1);
+ ntohl (target->distance) + 1,
+ neighbor->network);
}
return GNUNET_YES; /* got a route to this target already */
}
@@ -1443,7 +1447,9 @@
/* distance decreased, update route */
move_route (current_route,
ntohl (target->distance) + 1);
- send_distance_change_to_plugin (&target->peer, ntohl
(target->distance) + 1);
+ send_distance_change_to_plugin (&target->peer,
+ ntohl (target->distance) + 1,
+ neighbor->network);
}
}
return GNUNET_OK;
@@ -1461,7 +1467,9 @@
move_route (current_route, ntohl (target->distance) + 1);
current_route->next_hop = neighbor;
- send_distance_change_to_plugin (&target->peer, ntohl (target->distance) +
1);
+ send_distance_change_to_plugin (&target->peer,
+ ntohl (target->distance) + 1,
+ neighbor->network);
return GNUNET_OK;
}
/* new route */
Modified: gnunet/src/dv/plugin_transport_dv.c
===================================================================
--- gnunet/src/dv/plugin_transport_dv.c 2013-12-13 12:40:18 UTC (rev 31352)
+++ gnunet/src/dv/plugin_transport_dv.c 2013-12-13 12:48:34 UTC (rev 31353)
@@ -296,6 +296,7 @@
struct Session *session;
struct GNUNET_ATS_Information ats[2];
+ GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network);
/**
* This requires transport plugin to be linked to libgnunetats.
* If you remove it, also remove libgnunetats linkage from Makefile.am
@@ -350,26 +351,28 @@
* @param cls closure with `struct Plugin *`
* @param peer connected peer
* @param distance new distance to the peer
+ * @param network network type used for the connection
*/
static void
handle_dv_distance_changed (void *cls,
const struct GNUNET_PeerIdentity *peer,
- uint32_t distance)
+ uint32_t distance,
+ uint32_t network)
{
struct Plugin *plugin = cls;
struct Session *session;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message for peer `%s': new
distance %u\n",
- "DV_DISTANCE_CHANGED",
- GNUNET_i2s (peer), distance);
-
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received `%s' message for peer `%s': new distance %u\n",
+ "DV_DISTANCE_CHANGED",
+ GNUNET_i2s (peer),
+ distance);
session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
peer);
if (NULL == session)
{
GNUNET_break (0);
- /* FIXME */
- handle_dv_connect (plugin, peer, distance, 0);
+ handle_dv_connect (plugin, peer, distance, network);
return;
}
session->distance = distance;
Modified: gnunet/src/include/gnunet_dv_service.h
===================================================================
--- gnunet/src/include/gnunet_dv_service.h 2013-12-13 12:40:18 UTC (rev
31352)
+++ gnunet/src/include/gnunet_dv_service.h 2013-12-13 12:48:34 UTC (rev
31353)
@@ -40,7 +40,8 @@
*/
typedef void (*GNUNET_DV_ConnectCallback)(void *cls,
const struct GNUNET_PeerIdentity
*peer,
- uint32_t distance, uint32_t network);
+ uint32_t distance,
+ uint32_t network);
/**
@@ -50,10 +51,12 @@
* @param cls closure
* @param peer connected peer
* @param distance new distance to the peer
+ * @param network this network will be used to reach the next hop
*/
typedef void (*GNUNET_DV_DistanceChangedCallback)(void *cls,
const struct
GNUNET_PeerIdentity *peer,
- uint32_t distance);
+ uint32_t distance,
+ uint32_t network);
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31353 - in gnunet/src: dv include,
gnunet <=