[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35881 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35881 - gnunet/src/cadet |
Date: |
Mon, 8 Jun 2015 10:35:14 +0200 |
Author: grothoff
Date: 2015-06-08 10:35:14 +0200 (Mon, 08 Jun 2015)
New Revision: 35881
Modified:
gnunet/src/cadet/gnunet-service-cadet_connection.c
gnunet/src/cadet/gnunet-service-cadet_peer.c
gnunet/src/cadet/gnunet-service-cadet_peer.h
Log:
-indentation, doxygen, be a bit pickier about return values to eliminate
possible causes of #3794
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2015-06-08 08:17:47 UTC
(rev 35880)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2015-06-08 08:35:14 UTC
(rev 35881)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2001-2013 Christian Grothoff (and other contributing
authors)
+ Copyright (C) 2001-2015 Christian Grothoff (and other contributing
authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -17,7 +17,6 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file cadet/gnunet-service-cadet_connection.c
* @brief GNUnet CADET service connection handling
@@ -623,9 +622,11 @@
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P- %p %u\n", c, c->pending_messages);
c->pending_messages--;
- if (GNUNET_YES == c->destroy && 0 == c->pending_messages)
+ if ( (GNUNET_YES == c->destroy) &&
+ (0 == c->pending_messages) )
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "! destroying connection!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "! destroying connection!\n");
GCC_destroy (c);
return GNUNET_YES;
}
@@ -729,8 +730,8 @@
if (NULL == c->path)
return NULL;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG, " get prev hop %s [%u/%u]\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " get prev hop %s [%u/%u]\n",
GCC_2s (c), c->own_pos, c->path->length);
if (0 == c->own_pos || c->path->length < 2)
id = c->path->peers[0];
@@ -1376,7 +1377,8 @@
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
- LOG (GNUNET_ERROR_TYPE_INFO, "Connection %s FWD timed out. Destroying.\n",
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ "Connection %s FWD timed out. Destroying.\n",
GCC_2s (c));
GCC_debug (c, GNUNET_ERROR_TYPE_DEBUG);
@@ -1510,21 +1512,25 @@
GCC_2s (c), prev_peer);
LOG (GNUNET_ERROR_TYPE_DEBUG, "prev peer %p %s\n", prev_peer, GCP_2s
(prev_peer));
- if (GNUNET_NO == GCP_is_neighbor (next_peer)
- || GNUNET_NO == GCP_is_neighbor (prev_peer))
+ if ( (GNUNET_NO == GCP_is_neighbor (next_peer)) ||
+ (GNUNET_NO == GCP_is_neighbor (prev_peer)) )
{
if (GCC_is_origin (c, GNUNET_YES))
GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
GNUNET_STATISTICS_update (stats, "# bad paths", 1, GNUNET_NO);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " register neighbors failed\n");
- LOG (GNUNET_ERROR_TYPE_DEBUG, " prev: %s, neighbor?: %d\n",
- GCP_2s (prev_peer), GCP_is_neighbor (prev_peer));
- LOG (GNUNET_ERROR_TYPE_DEBUG, " next: %s, neighbor?: %d\n",
- GCP_2s (next_peer), GCP_is_neighbor (next_peer));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " register neighbors failed\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " prev: %s, neighbor?: %d\n",
+ GCP_2s (prev_peer),
+ GCP_is_neighbor (prev_peer));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " next: %s, neighbor?: %d\n",
+ GCP_2s (next_peer),
+ GCP_is_neighbor (next_peer));
return GNUNET_SYSERR;
}
-
GCP_add_connection (next_peer, c);
GCP_add_connection (prev_peer, c);
@@ -1543,18 +1549,9 @@
struct CadetPeer *peer;
peer = get_next_hop (c);
- if (GNUNET_OK != GCP_remove_connection (peer, c))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
- if (NULL != c->t) GCT_debug (c->t, GNUNET_ERROR_TYPE_DEBUG);
- }
-
+ GCP_remove_connection (peer, c);
peer = get_prev_hop (c);
- if (GNUNET_OK != GCP_remove_connection (peer, c))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
- if (NULL != c->t) GCT_debug (c->t, GNUNET_ERROR_TYPE_DEBUG);
- }
+ GCP_remove_connection (peer, c);
}
@@ -1634,7 +1631,8 @@
if (NULL == t)
return GNUNET_NO;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking for duplicates\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Checking for duplicates\n");
GCT_iterate_connections (t, &check_path, conn);
@@ -1985,8 +1983,8 @@
* @param id Peer identity of sending neighbor.
* @param message Message.
*
- * @return GNUNET_OK to keep the connection open,
- * GNUNET_SYSERR to close it (signal serious error)
+ * @return #GNUNET_OK to keep the connection open,
+ * #GNUNET_SYSERR to close it (signal serious error)
*/
int
GCC_handle_broken (void* cls,
@@ -2058,19 +2056,19 @@
* @param cls Closure (unused).
* @param peer Peer identity of sending neighbor.
* @param message Message.
- *
- * @return GNUNET_OK to keep the connection open,
- * GNUNET_SYSERR to close it (signal serious error)
+ * @return #GNUNET_OK to keep the connection open,
+ * #GNUNET_SYSERR to close it (signal serious error)
*/
int
-GCC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
+GCC_handle_destroy (void *cls,
+ const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_CADET_ConnectionDestroy *msg;
+ const struct GNUNET_CADET_ConnectionDestroy *msg;
struct CadetConnection *c;
int fwd;
- msg = (struct GNUNET_CADET_ConnectionDestroy *) message;
+ msg = (const struct GNUNET_CADET_ConnectionDestroy *) message;
log_message (message, peer, &msg->cid);
c = connection_get (&msg->cid);
if (NULL == c)
@@ -2081,7 +2079,8 @@
*/
GNUNET_STATISTICS_update (stats, "# control on unknown connection",
1, GNUNET_NO);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " connection unknown: already
destroyed?\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " connection unknown: already destroyed?\n");
return GNUNET_OK;
}
fwd = is_fwd (c, peer);
@@ -2651,9 +2650,9 @@
*
* @param cls Closure (unused).
* @param key Current key code (CID, unused).
- * @param value Value in the hash map (connection)
+ * @param value Value in the hash map (`struct CadetConnection`)
*
- * @return #GNUNET_YES, because we should continue to iterate,
+ * @return #GNUNET_YES, because we should continue to iterate
*/
static int
shutdown_iterator (void *cls,
@@ -2662,6 +2661,7 @@
{
struct CadetConnection *c = value;
+ c->state = CADET_CONNECTION_DESTROYED;
GCC_destroy (c);
return GNUNET_YES;
}
@@ -2673,7 +2673,9 @@
void
GCC_shutdown (void)
{
- GNUNET_CONTAINER_multihashmap_iterate (connections, &shutdown_iterator,
NULL);
+ GNUNET_CONTAINER_multihashmap_iterate (connections,
+ &shutdown_iterator,
+ NULL);
GNUNET_CONTAINER_multihashmap_destroy (connections);
connections = NULL;
}
@@ -2745,11 +2747,16 @@
return; /* -> message_sent -> GCC_destroy. Don't loop. */
c->destroy = 2;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s\n", GCC_2s (c));
- LOG (GNUNET_ERROR_TYPE_DEBUG, " fc's f: %p, b: %p\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "destroying connection %s\n",
+ GCC_2s (c));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " fc's f: %p, b: %p\n",
&c->fwd_fc, &c->bck_fc);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " fc tasks f: %u, b: %u\n",
- c->fwd_fc.poll_task, c->bck_fc.poll_task);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " fc tasks f: %u, b: %u\n",
+ c->fwd_fc.poll_task,
+ c->bck_fc.poll_task);
/* Cancel all traffic */
if (NULL != c->path)
@@ -2763,12 +2770,14 @@
if (NULL != c->fwd_fc.poll_msg)
{
GCC_cancel (c->fwd_fc.poll_msg);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg FWD canceled\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " *** POLL msg FWD canceled\n");
}
if (NULL != c->bck_fc.poll_msg)
{
GCC_cancel (c->bck_fc.poll_msg);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg BCK canceled\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " *** POLL msg BCK canceled\n");
}
/* Delete from tunnel */
@@ -2775,7 +2784,8 @@
if (NULL != c->t)
GCT_remove_connection (c->t, c);
- if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path)
+ if ( (GNUNET_NO == GCC_is_origin (c, GNUNET_YES)) &&
+ (NULL != c->path) )
path_destroy (c->path);
if (NULL != c->fwd_maintenance_task)
GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task);
@@ -2794,12 +2804,16 @@
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (connections,
- GCC_get_h (c), c));
-
- GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO);
+ GCC_get_h (c),
+ c));
+ GNUNET_STATISTICS_update (stats,
+ "# connections",
+ -1,
+ GNUNET_NO);
GNUNET_free (c);
}
+
/**
* Get the connection ID.
*
@@ -2983,9 +2997,9 @@
int fwd;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- " notify broken on %s due to %s disconnect\n",
- GCC_2s (c), GCP_2s (peer));
-
+ "Notify broken on %s due to %s disconnect\n",
+ GCC_2s (c),
+ GCP_2s (peer));
hop = get_prev_hop (c);
if (NULL == hop)
{
@@ -2993,7 +3007,6 @@
GNUNET_break (0);
return;
}
-
fwd = (peer == hop);
if (GNUNET_YES == GCC_is_terminal (c, fwd))
{
@@ -3014,8 +3027,6 @@
* Cancel all queues, if no message is left, connection will be destroyed.
*/
connection_cancel_queues (c, !fwd);
-
- return;
}
@@ -3486,4 +3497,3 @@
LOG2 (level, "CCC DEBUG CONNECTION END\n");
}
-
Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c 2015-06-08 08:17:47 UTC
(rev 35880)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c 2015-06-08 08:35:14 UTC
(rev 35881)
@@ -49,34 +49,34 @@
*/
struct CadetPeerQueue
{
- /**
- * DLL next
- */
+ /**
+ * DLL next
+ */
struct CadetPeerQueue *next;
- /**
- * DLL previous
- */
+ /**
+ * DLL previous
+ */
struct CadetPeerQueue *prev;
- /**
- * Peer this transmission is directed to.
- */
+ /**
+ * Peer this transmission is directed to.
+ */
struct CadetPeer *peer;
- /**
- * Connection this message belongs to.
- */
+ /**
+ * Connection this message belongs to.
+ */
struct CadetConnection *c;
- /**
- * Is FWD in c?
- */
+ /**
+ * Is FWD in c?
+ */
int fwd;
- /**
- * Pointer to info stucture used as cls.
- */
+ /**
+ * Pointer to info stucture used as cls.
+ */
void *cls;
/**
@@ -95,26 +95,27 @@
uint32_t payload_id;
/**
- * Size of the message
- */
+ * Size of the message
+ */
size_t size;
- /**
- * Set when this message starts waiting for CORE.
- */
+ /**
+ * Set when this message starts waiting for CORE.
+ */
struct GNUNET_TIME_Absolute start_waiting;
- /**
- * Function to call on sending.
- */
+ /**
+ * Function to call on sending.
+ */
GCP_sent cont;
- /**
- * Closure for callback.
- */
+ /**
+ * Closure for callback.
+ */
void *cont_cls;
};
+
/**
* Struct containing all information regarding a given peer
*/
@@ -150,19 +151,19 @@
*/
struct GNUNET_SCHEDULER_Task *search_delayed;
- /**
- * Tunnel to this peer, if any.
- */
+ /**
+ * Tunnel to this peer, if any.
+ */
struct CadetTunnel *tunnel;
- /**
- * Connections that go through this peer, indexed by tid;
- */
+ /**
+ * Connections that go through this peer, indexed by tid;
+ */
struct GNUNET_CONTAINER_MultiHashMap *connections;
- /**
- * Handle for queued transmissions
- */
+ /**
+ * Handle for queued transmissions
+ */
struct GNUNET_CORE_TransmitHandle *core_transmit;
/**
@@ -212,7 +213,7 @@
extern GNUNET_PEER_Id myid;
/**
- * Peers known, indexed by PeerIdentity (CadetPeer).
+ * Peers known, indexed by PeerIdentity, values of type `struct CadetPeer`.
*/
static struct GNUNET_CONTAINER_MultiPeerMap *peers;
@@ -347,10 +348,12 @@
struct CadetPeer *peer = cls;
struct CadetConnection *c = value;
- LOG (GNUNET_ERROR_TYPE_DEBUG, " notifying %s due to %s\n",
- GCC_2s (c), GCP_2s (peer));
- GCC_notify_broken (c, peer);
-
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Notifying %s due to %s\n",
+ GCC_2s (c),
+ GCP_2s (peer));
+ GCC_notify_broken (c,
+ peer);
return GNUNET_YES;
}
@@ -434,7 +437,8 @@
* @param peer peer identity this notification is about
*/
static void
-core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
+core_disconnect (void *cls,
+ const struct GNUNET_PeerIdentity *peer)
{
struct CadetPeer *p;
struct CadetPeerPath *direct_path;
@@ -441,7 +445,8 @@
char own_id[16];
strncpy (own_id, GNUNET_i2s (&my_full_id), 15);
- p = GNUNET_CONTAINER_multipeermap_get (peers, peer);
+ p = GNUNET_CONTAINER_multipeermap_get (peers,
+ peer);
if (NULL == p)
{
GNUNET_break (0);
@@ -448,12 +453,17 @@
return;
}
if (myid == p->id)
- LOG (GNUNET_ERROR_TYPE_INFO, "DISCONNECTED %s (self)\n", own_id);
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ "DISCONNECTED %s (self)\n",
+ own_id);
else
- LOG (GNUNET_ERROR_TYPE_INFO, "DISCONNECTED %s <= %s\n",
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ "DISCONNECTED %s <= %s\n",
own_id, GNUNET_i2s (peer));
direct_path = pop_direct_path (p);
- GNUNET_CONTAINER_multihashmap_iterate (p->connections, ¬ify_broken, p);
+ GNUNET_CONTAINER_multihashmap_iterate (p->connections,
+ ¬ify_broken,
+ p);
GNUNET_CONTAINER_multihashmap_destroy (p->connections);
p->connections = NULL;
if (NULL != p->core_transmit)
@@ -756,10 +766,14 @@
GNUNET_PEER_resolve (peer->id, &id);
GNUNET_PEER_change_rc (peer->id, -1);
- LOG (GNUNET_ERROR_TYPE_WARNING, "destroying peer %s\n", GNUNET_i2s (&id));
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "destroying peer %s\n",
+ GNUNET_i2s (&id));
if (GNUNET_YES !=
- GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer))
+ GNUNET_CONTAINER_multipeermap_remove (peers,
+ &id,
+ peer))
{
GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_WARNING, " not in peermap!!\n");
@@ -1634,7 +1648,8 @@
void
GCP_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "GCP_init\n");
peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c, "CADET", "MAX_PEERS",
@@ -1704,19 +1719,22 @@
void
GCP_shutdown (void)
{
- GNUNET_CONTAINER_multipeermap_iterate (peers, &shutdown_tunnel, NULL);
-
- if (core_handle != NULL)
+ GNUNET_CONTAINER_multipeermap_iterate (peers,
+ &shutdown_tunnel,
+ NULL);
+ if (NULL != core_handle)
{
GNUNET_CORE_disconnect (core_handle);
core_handle = NULL;
}
- if (transport_handle != NULL)
+ if (NULL != transport_handle)
{
GNUNET_TRANSPORT_disconnect (transport_handle);
transport_handle = NULL;
}
GNUNET_PEER_change_rc (myid, -1);
+ GNUNET_CONTAINER_multipeermap_destroy (peers);
+ peers = NULL;
}
@@ -1741,9 +1759,11 @@
{
peer_delete_oldest ();
}
- GNUNET_CONTAINER_multipeermap_put (peers, peer_id, peer,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
- peer->id = GNUNET_PEER_intern (peer_id);
+ GNUNET_CONTAINER_multipeermap_put (peers,
+ peer_id,
+ peer,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ peer->id = GNUNET_PEER_intern (peer_id);
}
peer->last_contact = GNUNET_TIME_absolute_get ();
@@ -1921,38 +1941,30 @@
*
* @param peer Peer to add connection to.
* @param c Connection to add.
- *
- * @return GNUNET_OK on success.
*/
-int
+void
GCP_add_connection (struct CadetPeer *peer,
struct CadetConnection *c)
{
- int result;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GCC_2s (c));
- LOG (GNUNET_ERROR_TYPE_DEBUG, "to peer %s\n", GCP_2s (peer));
-
- if (NULL == peer->connections)
- {
- GNUNET_break (0);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Peer %s is not a neighbor!\n",
- GCP_2s (peer));
- return GNUNET_SYSERR;
- }
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "peer %s ok, has %u connections.\n",
- GCP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections));
- result = GNUNET_CONTAINER_multihashmap_put (peer->connections,
- GCC_get_h (c),
- c,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ "adding connection %s\n",
+ GCC_2s (c));
LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "to peer %s\n",
+ GCP_2s (peer));
+ GNUNET_assert (NULL != peer->connections);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "peer %s has %u connections.\n",
+ GCP_2s (peer),
+ GNUNET_CONTAINER_multihashmap_size (peer->connections));
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_put (peer->connections,
+ GCC_get_h (c),
+ c,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" now has %u connections.\n",
GNUNET_CONTAINER_multihashmap_size (peer->connections));
- LOG (GNUNET_ERROR_TYPE_DEBUG, "result %u\n", result);
-
- return result;
}
@@ -2121,8 +2133,11 @@
GNUNET_assert (myid == path->peers[0]);
GNUNET_assert (peer->id == path->peers[path->length - 1]);
- LOG (GNUNET_ERROR_TYPE_INFO, "Removing path %p (%u) from %s\n",
- path, path->length, GCP_2s (peer));
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ "Removing path %p (%u) from %s\n",
+ path,
+ path->length,
+ GCP_2s (peer));
for (iter = peer->path_head; NULL != iter; iter = next)
{
@@ -2143,30 +2158,28 @@
*
* @param peer Peer to remove connection from.
* @param c Connection to remove.
- *
- * @return GNUNET_OK on success.
*/
-int
+void
GCP_remove_connection (struct CadetPeer *peer,
const struct CadetConnection *c)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GCC_2s (c));
- LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GCP_2s (peer));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "removing connection %s\n",
+ GCC_2s (c));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "from peer %s\n",
+ GCP_2s (peer));
- if (NULL == peer || NULL == peer->connections)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Peer %s is not a neighbor!\n",
- GCP_2s (peer));
- return GNUNET_SYSERR;
- }
+ GNUNET_assert ( (NULL != peer) &&
+ (NULL != peer->connections) );
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (peer->connections,
+ GCC_get_h (c),
+ c));
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "peer %s ok, has %u connections.\n",
- GCP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections));
-
- return GNUNET_CONTAINER_multihashmap_remove (peer->connections,
- GCC_get_h (c),
- c);
+ "peer %s ok, has %u connections left.\n",
+ GCP_2s (peer),
+ GNUNET_CONTAINER_multihashmap_size (peer->connections));
}
/**
@@ -2454,9 +2467,12 @@
* @param cls Closure for @c iter.
*/
void
-GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls)
+GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter,
+ void *cls)
{
- GNUNET_CONTAINER_multipeermap_iterate (peers, iter, cls);
+ GNUNET_CONTAINER_multipeermap_iterate (peers,
+ iter,
+ cls);
}
Modified: gnunet/src/cadet/gnunet-service-cadet_peer.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.h 2015-06-08 08:17:47 UTC
(rev 35880)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.h 2015-06-08 08:35:14 UTC
(rev 35881)
@@ -215,6 +215,7 @@
void
GCP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel *t);
+
/**
* Check whether there is a direct (core level) connection to peer.
*
@@ -225,6 +226,7 @@
int
GCP_is_neighbor (const struct CadetPeer *peer);
+
/**
* Create and initialize a new tunnel towards a peer, in case it has none.
*
@@ -235,6 +237,7 @@
void
GCP_add_tunnel (struct CadetPeer *peer);
+
/**
* Add a connection to a neighboring peer.
*
@@ -244,12 +247,12 @@
*
* @param peer Peer to add connection to.
* @param c Connection to add.
- *
- * @return GNUNET_OK on success.
*/
-int
-GCP_add_connection (struct CadetPeer *peer, struct CadetConnection *c);
+void
+GCP_add_connection (struct CadetPeer *peer,
+ struct CadetConnection *c);
+
/**
* Add the path to the peer and update the path used to reach it in case this
* is the shortest.
@@ -263,8 +266,11 @@
* NULL on error.
*/
struct CadetPeerPath *
-GCP_add_path (struct CadetPeer *peer, struct CadetPeerPath *p, int trusted);
+GCP_add_path (struct CadetPeer *peer,
+ struct CadetPeerPath *p,
+ int trusted);
+
/**
* Add the path to the origin peer and update the path used to reach it in case
* this is the shortest.
@@ -293,6 +299,7 @@
void
GCP_add_path_to_all (const struct CadetPeerPath *p, int confirmed);
+
/**
* Remove any path to the peer that has the extact same peers as the one given.
*
@@ -300,19 +307,21 @@
* @param path Path to remove. Is always destroyed .
*/
void
-GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path);
+GCP_remove_path (struct CadetPeer *peer,
+ struct CadetPeerPath *path);
+
/**
* Remove a connection from a neighboring peer.
*
* @param peer Peer to remove connection from.
* @param c Connection to remove.
- *
- * @return GNUNET_OK on success.
*/
-int
-GCP_remove_connection (struct CadetPeer *peer, const struct CadetConnection
*c);
+void
+GCP_remove_connection (struct CadetPeer *peer,
+ const struct CadetConnection *c);
+
/**
* Start the DHT search for new paths towards the peer: we don't have
* enough good connections.
@@ -322,6 +331,7 @@
void
GCP_start_search (struct CadetPeer *peer);
+
/**
* Stop the DHT search for new paths towards the peer: we already have
* enough good connections.
@@ -331,6 +341,7 @@
void
GCP_stop_search (struct CadetPeer *peer);
+
/**
* Get the Full ID of a peer.
*
@@ -341,6 +352,7 @@
const struct GNUNET_PeerIdentity *
GCP_get_id (const struct CadetPeer *peer);
+
/**
* Get the Short ID of a peer.
*
@@ -351,6 +363,7 @@
GNUNET_PEER_Id
GCP_get_short_id (const struct CadetPeer *peer);
+
/**
* Get the tunnel towards a peer.
*
@@ -361,6 +374,7 @@
struct CadetTunnel *
GCP_get_tunnel (const struct CadetPeer *peer);
+
/**
* Set the hello message.
*
@@ -368,8 +382,10 @@
* @param hello Hello message.
*/
void
-GCP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message
*hello);
+GCP_set_hello (struct CadetPeer *peer,
+ const struct GNUNET_HELLO_Message *hello);
+
/**
* Get the hello message.
*
@@ -389,6 +405,7 @@
void
GCP_try_connect (struct CadetPeer *peer);
+
/**
* Notify a peer that a link between two other peers is broken. If any path
* used that link, eliminate it.
@@ -402,6 +419,7 @@
struct GNUNET_PeerIdentity *peer1,
struct GNUNET_PeerIdentity *peer2);
+
/**
* Count the number of known paths toward the peer.
*
@@ -412,6 +430,7 @@
unsigned int
GCP_count_paths (const struct CadetPeer *peer);
+
/**
* Iterate all known peers.
*
@@ -421,6 +440,7 @@
void
GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls);
+
/**
* Get the static string for a peer ID.
*
@@ -431,6 +451,7 @@
const char *
GCP_2s (const struct CadetPeer *peer);
+
/**
* Log all kinds of info about a peer.
*
@@ -437,7 +458,8 @@
* @param peer Peer.
*/
void
-GCP_debug (const struct CadetPeer *p, enum GNUNET_ErrorType level);
+GCP_debug (const struct CadetPeer *p,
+ enum GNUNET_ErrorType level);
#if 0 /* keep Emacsens' auto-indent happy */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35881 - gnunet/src/cadet,
gnunet <=