[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35888 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35888 - gnunet/src/cadet |
Date: |
Mon, 8 Jun 2015 21:59:01 +0200 |
Author: grothoff
Date: 2015-06-08 21:59:01 +0200 (Mon, 08 Jun 2015)
New Revision: 35888
Modified:
gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
-adding additional error checking logic
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2015-06-08 19:49:23 UTC
(rev 35887)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2015-06-08 19:59:01 UTC
(rev 35888)
@@ -198,6 +198,16 @@
struct CadetPeerQueue *maintenance_q;
/**
+ * Should equal #get_next_hop(this).
+ */
+ struct CadetPeer *next_peer;
+
+ /**
+ * Should equal #get_prev_hop(this).
+ */
+ struct CadetPeer *prev_peer;
+
+ /**
* State of the connection.
*/
enum CadetConnectionState state;
@@ -1431,7 +1441,7 @@
if (GCC_is_origin (c, GNUNET_YES) && 0 < c->fwd_fc.queue_n)
{
send_broken_unknown (&c->id, &my_full_id, NULL,
- GCP_get_id( get_next_hop (c)));
+ GCP_get_id (get_next_hop (c)));
resend_messages_and_destroy (c, GNUNET_YES);
return;
}
@@ -1493,25 +1503,33 @@
static int
register_neighbors (struct CadetConnection *c)
{
- struct CadetPeer *next_peer;
- struct CadetPeer *prev_peer;
+ c->next_peer = get_next_hop (c);
+ c->prev_peer = get_prev_hop (c);
- next_peer = get_next_hop (c);
- prev_peer = get_prev_hop (c);
-
- LOG (GNUNET_ERROR_TYPE_DEBUG, "register neighbors for connection %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "register neighbors for connection %s\n",
GCC_2s (c));
path_debug (c->path);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "own pos %u\n", c->own_pos);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to next peer %p\n",
- GCC_2s (c), next_peer);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "next peer %p %s\n", next_peer, GCP_2s
(next_peer));
- LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to prev peer %p\n",
- GCC_2s (c), prev_peer);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "prev peer %p %s\n", prev_peer, GCP_2s
(prev_peer));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "own pos %u\n", c->own_pos);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "putting connection %s to next peer %p\n",
+ GCC_2s (c),
+ c->next_peer);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "next peer %p %s\n",
+ c->next_peer,
+ GCP_2s (c->next_peer));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "putting connection %s to prev peer %p\n",
+ GCC_2s (c),
+ c->prev_peer);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "prev peer %p %s\n",
+ c->prev_peer,
+ GCP_2s (c->prev_peer));
- if ( (GNUNET_NO == GCP_is_neighbor (next_peer)) ||
- (GNUNET_NO == GCP_is_neighbor (prev_peer)) )
+ if ( (GNUNET_NO == GCP_is_neighbor (c->next_peer)) ||
+ (GNUNET_NO == GCP_is_neighbor (c->prev_peer)) )
{
if (GCC_is_origin (c, GNUNET_YES))
GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
@@ -1521,16 +1539,16 @@
" register neighbors failed\n");
LOG (GNUNET_ERROR_TYPE_DEBUG,
" prev: %s, neighbor?: %d\n",
- GCP_2s (prev_peer),
- GCP_is_neighbor (prev_peer));
+ GCP_2s (c->prev_peer),
+ GCP_is_neighbor (c->prev_peer));
LOG (GNUNET_ERROR_TYPE_DEBUG,
" next: %s, neighbor?: %d\n",
- GCP_2s (next_peer),
- GCP_is_neighbor (next_peer));
+ GCP_2s (c->next_peer),
+ GCP_is_neighbor (c->next_peer));
return GNUNET_SYSERR;
}
- GCP_add_connection (next_peer, c);
- GCP_add_connection (prev_peer, c);
+ GCP_add_connection (c->next_peer, c);
+ GCP_add_connection (c->prev_peer, c);
return GNUNET_OK;
}
@@ -1547,8 +1565,10 @@
struct CadetPeer *peer;
peer = get_next_hop (c);
+ GNUNET_assert (c->next_peer == peer);
GCP_remove_connection (peer, c);
peer = get_prev_hop (c);
+ GNUNET_assert (c->prev_peer == peer);
GCP_remove_connection (peer, c);
}
@@ -2162,6 +2182,7 @@
else
{
hop = get_next_hop (c);
+ GNUNET_break (hop == c->next_peer);
if (neighbor_id == GCP_get_short_id (hop))
{
fwd = GNUNET_NO;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35888 - gnunet/src/cadet,
gnunet <=