[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29977 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29977 - gnunet/src/mesh |
Date: |
Tue, 8 Oct 2013 13:08:09 +0200 |
Author: bartpolot
Date: 2013-10-08 13:08:09 +0200 (Tue, 08 Oct 2013)
New Revision: 29977
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
Log:
- export core handlers from connection: all p2p messages are connection related
but core is connected to peers
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-10-08 11:07:32 UTC
(rev 29976)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-10-08 11:08:09 UTC
(rev 29977)
@@ -1001,9 +1001,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ConnectionCreate *msg;
struct GNUNET_PeerIdentity *id;
@@ -1140,9 +1140,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ConnectionACK *msg;
struct MeshConnection *c;
@@ -1243,9 +1243,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_broken (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_broken (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ConnectionBroken *msg;
struct MeshConnection *c;
@@ -1280,9 +1280,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ConnectionDestroy *msg;
struct MeshConnection *c;
@@ -1457,9 +1457,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_fwd (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_fwd (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
return handle_mesh_encrypted (peer,
(struct GNUNET_MESH_Encrypted *)message,
@@ -1476,9 +1476,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_bck (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_bck (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
return handle_mesh_encrypted (peer,
(struct GNUNET_MESH_Encrypted *)message,
@@ -1496,9 +1496,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ACK *msg;
struct MeshConnection *c;
@@ -1573,9 +1573,9 @@
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
-static int
-handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_Poll *msg;
struct MeshConnection *c;
@@ -1644,9 +1644,9 @@
*
* TODO: Check who we got this from, to validate route.
*/
-static int
-handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
+int
+GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ConnectionKeepAlive *msg;
struct MeshConnection *c;
@@ -1690,33 +1690,6 @@
/**
- * Functions to handle messages from core
- */
-static struct GNUNET_CORE_MessageHandler core_handlers[] = {
- {&handle_create, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE,
- 0},
- {&handle_confirm, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
- sizeof (struct GNUNET_MESH_ConnectionACK)},
- {&handle_broken, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN,
- sizeof (struct GNUNET_MESH_ConnectionBroken)},
- {&handle_destroy, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY,
- sizeof (struct GNUNET_MESH_ConnectionDestroy)},
- {&handle_keepalive, GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE,
- sizeof (struct GNUNET_MESH_ConnectionKeepAlive)},
- {&handle_keepalive, GNUNET_MESSAGE_TYPE_MESH_BCK_KEEPALIVE,
- sizeof (struct GNUNET_MESH_ConnectionKeepAlive)},
- {&handle_ack, GNUNET_MESSAGE_TYPE_MESH_ACK,
- sizeof (struct GNUNET_MESH_ACK)},
- {&handle_poll, GNUNET_MESSAGE_TYPE_MESH_POLL,
- sizeof (struct GNUNET_MESH_Poll)},
- {&handle_fwd, GNUNET_MESSAGE_TYPE_MESH_FWD, 0},
- {&handle_bck, GNUNET_MESSAGE_TYPE_MESH_BCK, 0},
- {NULL, 0, 0}
-};
-
-
-
-/**
* Send an ACK on the appropriate connection/channel, depending on
* the direction and the position of the peer.
*
@@ -1979,7 +1952,7 @@
* @param fwd Is this a fwd message?
*/
void
-GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
+GMC_send_prebuilt_message ( const struct GNUNET_MessageHeader *message,
struct MeshConnection *c,
struct MeshChannel *ch,
int fwd)
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.h 2013-10-08 11:07:32 UTC
(rev 29976)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.h 2013-10-08 11:08:09 UTC
(rev 29977)
@@ -44,7 +44,138 @@
*/
struct MeshConnection;
+
+
+
/**
+ * Core handler for connection creation.
+ *
+ * @param cls Closure (unused).
+ * @param peer Sender (neighbor).
+ * @param message Message.
+ *
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+int
+GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
+ * Core handler for path confirmations.
+ *
+ * @param cls closure
+ * @param message message
+ * @param peer peer identity this notification is about
+ *
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+int
+GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
+ * Core handler for notifications of broken paths
+ *
+ * @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)
+ */
+int
+GMC_handle_broken (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
+ * Core handler for tunnel destruction
+ *
+ * @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)
+ */
+int
+GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
+ * Core handler for mesh network traffic going orig->dest.
+ *
+ * @param cls Closure (unused).
+ * @param message Message received.
+ * @param peer Peer who sent the message.
+ *
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+int
+GMC_handle_fwd (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+
+/**
+ * Core handler for mesh network traffic going dest->orig.
+ *
+ * @param cls Closure (unused).
+ * @param message Message received.
+ * @param peer Peer who sent the message.
+ *
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+int
+GMC_handle_bck (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
+ * Core handler for mesh network traffic point-to-point acks.
+ *
+ * @param cls closure
+ * @param message message
+ * @param peer peer identity this notification is about
+ *
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+int
+GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
+ * Core handler for mesh network traffic point-to-point ack polls.
+ *
+ * @param cls closure
+ * @param message message
+ * @param peer peer identity this notification is about
+ *
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+int
+GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
+ * Core handler for mesh keepalives.
+ *
+ * @param cls closure
+ * @param message message
+ * @param peer peer identity this notification is about
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ *
+ * TODO: Check who we got this from, to validate route.
+ */
+int
+GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
+
+/**
* Initialize the connections subsystem
*
* @param c Configuration handle.
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c 2013-10-08 11:07:32 UTC (rev
29976)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c 2013-10-08 11:08:09 UTC (rev
29977)
@@ -24,6 +24,8 @@
#include "gnunet_core_service.h"
+#include "mesh_protocol_enc.h"
+
#include "gnunet-service-mesh_peer.h"
#include "gnunet-service-mesh_dht.h"
#include "gnunet-service-mesh_connection.h"
@@ -154,6 +156,7 @@
return GNUNET_YES;
}
+
/**
* Method called whenever a given peer connects.
*
@@ -171,12 +174,12 @@
pi = peer_get (peer);
if (myid == pi->id)
{
- DEBUG_CONN (" (self)\n");
+ LOG (" (self)\n");
path = path_new (1);
}
else
{
- DEBUG_CONN (" %s\n", GNUNET_i2s (peer));
+ LOG (" %s\n", GNUNET_i2s (peer));
path = path_new (2);
path->peers[1] = pi->id;
GNUNET_PEER_change_rc (pi->id, 1);
@@ -202,7 +205,7 @@
{
struct MeshPeer *pi;
- DEBUG_CONN ("Peer disconnected\n");
+ LOG ("Peer disconnected\n");
pi = GNUNET_CONTAINER_multipeermap_get (peers, peer);
if (NULL == pi)
{
@@ -220,7 +223,7 @@
}
if (myid == pi->id)
{
- DEBUG_CONN (" (self)\n");
+ LOG (" (self)\n");
}
GNUNET_STATISTICS_update (stats, "# peers", -1, GNUNET_NO);
@@ -228,7 +231,32 @@
}
+/**
+ * Functions to handle messages from core
+ */
+static struct GNUNET_CORE_MessageHandler core_handlers[] = {
+ {&GMC_handle_create, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE,
+ 0},
+ {&GMC_handle_confirm, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
+ sizeof (struct GNUNET_MESH_ConnectionACK)},
+ {&GMC_handle_broken, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN,
+ sizeof (struct GNUNET_MESH_ConnectionBroken)},
+ {&GMC_handle_destroy, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY,
+ sizeof (struct GNUNET_MESH_ConnectionDestroy)},
+ {&GMC_handle_keepalive, GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE,
+ sizeof (struct GNUNET_MESH_ConnectionKeepAlive)},
+ {&GMC_handle_keepalive, GNUNET_MESSAGE_TYPE_MESH_BCK_KEEPALIVE,
+ sizeof (struct GNUNET_MESH_ConnectionKeepAlive)},
+ {&GMC_handle_ack, GNUNET_MESSAGE_TYPE_MESH_ACK,
+ sizeof (struct GNUNET_MESH_ACK)},
+ {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_MESH_POLL,
+ sizeof (struct GNUNET_MESH_Poll)},
+ {&GMC_handle_fwd, GNUNET_MESSAGE_TYPE_MESH_FWD, 0},
+ {&GMC_handle_bck, GNUNET_MESSAGE_TYPE_MESH_BCK, 0},
+ {NULL, 0, 0}
+};
+
/**
* To be called on core init/fail.
*
@@ -242,16 +270,12 @@
const struct GNUNET_CONFIGURATION_Handle *c = cls;
static int i = 0;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core init\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Core init\n");
if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n"));
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- " core id %s\n",
- GNUNET_i2s (identity));
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- " my id %s\n",
- GNUNET_i2s (&my_full_id));
+ LOG (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n"));
+ LOG (GNUNET_ERROR_TYPE_ERROR, " core id %s\n", GNUNET_i2s (identity));
+ LOG (GNUNET_ERROR_TYPE_ERROR, " my id %s\n", GNUNET_i2s (&my_full_id));
GNUNET_CORE_disconnect (core_handle);
core_handle = GNUNET_CORE_connect (c, /* Main configuration */
NULL, /* Closure passed to MESH
functions */
@@ -316,7 +340,7 @@
size_t size_needed;
int i;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION CREATE...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION CREATE...\n");
size_needed =
sizeof (struct GNUNET_MESH_ConnectionCreate) +
p->length * sizeof (struct GNUNET_PeerIdentity);
@@ -337,7 +361,7 @@
GNUNET_PEER_resolve (p->peers[i], peer_ptr++);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"CONNECTION CREATE (%u bytes long) sent!\n", size_needed);
return size_needed;
}
@@ -358,7 +382,7 @@
struct GNUNET_MESH_ConnectionACK *msg = buf;
struct MeshTunnel2 *t = c->t;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION ACK...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION ACK...\n");
GNUNET_assert (NULL != t);
if (sizeof (struct GNUNET_MESH_ConnectionACK) > size)
{
@@ -372,7 +396,7 @@
/* TODO add signature */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n");
return sizeof (struct GNUNET_MESH_ConnectionACK);
}
@@ -426,7 +450,7 @@
GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer))
{
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"removing peer %s, not in peermap\n", GNUNET_i2s (&id));
}
if (NULL != peer->search_h)
@@ -703,7 +727,7 @@
{
if (path->peers[l] == myid)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shortening path by %u\n", l);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "shortening path by %u\n", l);
for (l2 = 0; l2 < path->length - l; l2++)
{
path->peers[l2] = path->peers[l + l2];
@@ -715,7 +739,7 @@
}
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n",
path->length, peer2s (peer_info));
l = path_get_length (path);
@@ -823,7 +847,7 @@
if (peer->tunnel->state == MESH_TUNNEL_SEARCHING)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n");
GMP_connect (peer);
}
return;
@@ -856,11 +880,11 @@
int fwd;
peer->core_transmit = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Queue send (max %u)\n", size);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* Queue send (max %u)\n", size);
if (NULL == buf || 0 == size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Buffer size 0.\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* Buffer size 0.\n");
return 0;
}
@@ -876,11 +900,11 @@
fc = fwd ? &c->fwd_fc : &c->bck_fc;
dst_id = GNUNET_PEER_resolve2 (peer->id);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* towards %s\n", GNUNET_i2s
(dst_id));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* towards %s\n", GNUNET_i2s (dst_id));
/* Check if buffer size is enough for the message */
if (queue->size > size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* not enough room, reissue\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* not enough room, reissue\n");
peer->core_transmit =
GNUNET_CORE_notify_transmit_ready (core_handle,
GNUNET_NO,
@@ -892,7 +916,7 @@
peer);
return 0;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* size %u ok\n", queue->size);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* size %u ok\n", queue->size);
t = (NULL != c) ? c->t : NULL;
type = 0;
@@ -907,7 +931,7 @@
case GNUNET_MESSAGE_TYPE_MESH_BCK:
case GNUNET_MESSAGE_TYPE_MESH_ACK:
case GNUNET_MESSAGE_TYPE_MESH_POLL:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"* raw: %s\n",
GNUNET_MESH_DEBUG_M2S (queue->type));
data_size = send_core_data_raw (queue->cls, size, buf);
@@ -915,14 +939,14 @@
type = ntohs (msg->type);
break;
case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* path create\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* path create\n");
if (GMC_is_origin (c, GNUNET_YES))
data_size = send_core_connection_create (queue->c, size, buf);
else
data_size = send_core_data_raw (queue->cls, size, buf);
break;
case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* path ack\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* path ack\n");
if (GMC_is_origin (c, GNUNET_NO) ||
GMC_is_origin (c, GNUNET_YES))
data_size = send_core_connection_ack (queue->c, size, buf);
@@ -938,7 +962,7 @@
break;
default:
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "* type unknown: %u\n",
+ LOG (GNUNET_ERROR_TYPE_WARNING, "* type unknown: %u\n",
queue->type);
data_size = 0;
}
@@ -946,7 +970,7 @@
if (0 < drop_percent &&
GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 101) < drop_percent)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"Dropping message of type %s\n",
GNUNET_MESH_DEBUG_M2S (queue->type));
data_size = 0;
@@ -962,7 +986,7 @@
case GNUNET_MESSAGE_TYPE_MESH_FWD:
case GNUNET_MESSAGE_TYPE_MESH_BCK:
pid = ntohl ( ((struct GNUNET_MESH_Encrypted *) buf)->pid );
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* accounting pid %u\n", pid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* accounting pid %u\n", pid);
fc->last_pid_sent = pid;
send_ack (c, ch, fwd);
break;
@@ -974,7 +998,7 @@
queue = peer_get_first_message (peer);
if (NULL != queue)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* more data!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* more data!\n");
if (NULL == peer->core_transmit) {
peer->core_transmit =
GNUNET_CORE_notify_transmit_ready(core_handle,
@@ -988,12 +1012,12 @@
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"* tmt rdy called somewhere else\n");
}
if (GNUNET_SCHEDULER_NO_TASK == fc->poll_task)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* starting poll timeout\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* starting poll timeout\n");
fc->poll_task =
GNUNET_SCHEDULER_add_delayed (fc->poll_time, &connection_poll, fc);
}
@@ -1011,7 +1035,7 @@
c->pending_messages--;
if (GNUNET_YES == c->destroy && 0 == c->pending_messages)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* destroying connection!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* destroying connection!\n");
GMC_destroy (c);
}
}
@@ -1021,11 +1045,11 @@
t->pending_messages--;
if (GNUNET_YES == t->destroy && 0 == t->pending_messages)
{
-// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* destroying tunnel!\n");
+// LOG (GNUNET_ERROR_TYPE_DEBUG, "* destroying tunnel!\n");
tunnel_destroy (t);
}
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Return %d\n", data_size);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "* Return %d\n", data_size);
return data_size;
}
@@ -1101,13 +1125,13 @@
if (GNUNET_YES == clear_cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " queue destroy type %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " queue destroy type %s\n",
GNUNET_MESH_DEBUG_M2S (queue->type));
switch (queue->type)
{
case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n");
+ LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n");
GNUNET_break (GNUNET_YES == queue->c->destroy);
/* fall through */
case GNUNET_MESSAGE_TYPE_MESH_FWD:
@@ -1117,13 +1141,13 @@
case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " prebuilt message\n");;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " prebuilt message\n");;
GNUNET_free_non_null (queue->cls);
break;
default:
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " type %s unknown!\n",
+ LOG (GNUNET_ERROR_TYPE_ERROR, " type %s unknown!\n",
GNUNET_MESH_DEBUG_M2S (queue->type));
}
@@ -1133,7 +1157,7 @@
if (queue->type != GNUNET_MESSAGE_TYPE_MESH_ACK &&
queue->type != GNUNET_MESSAGE_TYPE_MESH_POLL)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Q_N- %p %u\n", fc, fc->queue_n);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N- %p %u\n", fc, fc->queue_n);
fc->queue_n--;
peer->queue_n--;
}
@@ -1173,7 +1197,7 @@
int priority;
int call_core;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"queue add %s %s (%u) on c %p, ch %p\n",
fwd ? "FWD" : "BCK", GNUNET_MESH_DEBUG_M2S (type), size, c, ch);
GNUNET_assert (NULL != c);
@@ -1202,28 +1226,28 @@
priority = 100;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "fc %p\n", fc);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "fc %p\n", fc);
if (fc->queue_n >= fc->queue_max && 0 == priority)
{
GNUNET_STATISTICS_update (stats, "# messages dropped (buffer full)",
1, GNUNET_NO);
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"queue full: %u/%u\n",
fc->queue_n, fc->queue_max);
return; /* Drop this message */
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "last pid %u\n", fc->last_pid_sent);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", fc->last_ack_recv);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid %u\n", fc->last_pid_sent);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", fc->last_ack_recv);
if (GMC_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv))
{
call_core = GNUNET_NO;
if (GNUNET_SCHEDULER_NO_TASK == fc->poll_task &&
GNUNET_MESSAGE_TYPE_MESH_POLL != type)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"no buffer space (%u > %u): starting poll\n",
fc->last_pid_sent + 1, fc->last_ack_recv);
fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time,
@@ -1260,14 +1284,14 @@
else
{
GNUNET_CONTAINER_DLL_insert_tail (peer->queue_head, peer->queue_tail,
queue);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n);
fc->queue_n++;
peer->queue_n++;
}
if (NULL == peer->core_transmit && GNUNET_YES == call_core)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"calling core tmt rdy towards %s for %u bytes\n",
peer2s (peer), size);
peer->core_transmit =
@@ -1282,7 +1306,7 @@
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"core tmt rdy towards %s already called\n",
peer2s (peer));
@@ -1310,7 +1334,7 @@
GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_PEERS",
&max_peers))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ LOG_config_invalid (GNUNET_ERROR_TYPE_WARNING,
"MESH", "MAX_PEERS", "USING DEFAULT");
max_peers = 1000;
}
@@ -1323,7 +1347,7 @@
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"\n***************************************\n"
"Mesh is running with drop mode enabled.\n"
"This is NOT a good idea!\n"
@@ -1374,7 +1398,7 @@
struct MeshConnection *c;
int rerun_search;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"peer_connect towards %s\n",
peer2s (peer));
t = peer->tunnel;
@@ -1383,11 +1407,11 @@
if (NULL != peer->path_head)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "path exists\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "path exists\n");
p = peer_get_best_path (peer);
if (NULL != p)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u hops\n", p->length);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " %u hops\n", p->length);
c = tunnel_use_path (t, p);
if (NULL == c)
{
@@ -1418,7 +1442,7 @@
{
GMD_search_stop (peer->search_h);
peer->search_h = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" Stopping DHT GET for peer %s\n", peer2s (peer));
}
@@ -1427,7 +1451,7 @@
const struct GNUNET_PeerIdentity *id;
id = GNUNET_PEER_resolve2 (peer->id);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" Starting DHT GET for peer %s\n", peer2s (peer));
peer->search_h = GMD_search (id, &search_handler, peer);
if (MESH_TUNNEL_NEW == t->state)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29977 - gnunet/src/mesh,
gnunet <=