#define DEBUG_PING_PONG GNUNET_NO
-#define DEBUG_TRANSPORT_HELLO GNUNET_NO
+#define DEBUG_TRANSPORT_HELLO GNUNET_YES
/**
* Should we do some additional checks (to validate behavior
fal = find_peer_address (n, tname, NULL, addr, addrlen);
if (fal == NULL)
{
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_HELLO
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding address `%s' (%s) for peer `%4s' due to PEERINFO data for %llums.\n",
a2s (tname, addr, addrlen),
}
if (fal == NULL)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to add new address for `%4s'\n",
GNUNET_i2s (&n->id));
return GNUNET_OK;
if (do_hello)
{
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# peerinfo iterate requests"),
+ gettext_noop ("# peerinfo new neighbor iterate requests"),
1,
GNUNET_NO);
GNUNET_STATISTICS_update (stats,
n = find_neighbour(peer);
if (n != NULL)
{
- cont (cont_cls, n);
+ if (cont != NULL)
+ cont (cont_cls, n);
return;
}
if (bl_head == NULL)
{
- cont (cont_cls,
- setup_new_neighbour (peer, do_hello));
+ if (cont != NULL)
+ cont (cont_cls, setup_new_neighbour (peer, do_hello));
+ else
+ setup_new_neighbour(peer, do_hello);
return;
}
bc = GNUNET_malloc (sizeof (struct BlacklistCheck));
ping.challenge = htonl(va->challenge);
memcpy(&ping.target, &neighbour->id, sizeof(struct GNUNET_PeerIdentity));
if (peer_address->validated != GNUNET_YES)
- memcpy(message_buf, our_hello, hello_size);
+ {
+ memcpy(message_buf, our_hello, hello_size);
+ }
if (peer_address->addr != NULL)
{
#endif
if (peer_address->validated != GNUNET_YES)
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# PING+HELLO messages sent"),
+ gettext_noop ("# PING with HELLO messages sent"),
+ 1,
+ GNUNET_NO);
+ else
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# PING without HELLO messages sent"),
1,
GNUNET_NO);
}
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received message of type %u and size %u from `%4s', sending to all clients.\n",
ntohs (message->type),
ntohs (message->size),
NULL);
GNUNET_PEERINFO_add_peer (peerinfo, plain_hello);
GNUNET_free (plain_hello);
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_HELLO
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"PEERINFO had no `%s' message for peer `%4s', full validation needed.\n",
"HELLO",
}
if (h == NULL)
return;
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_HELLO
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"PEERINFO had `%s' message for peer `%4s', validating only new addresses.\n",
"HELLO",
n = find_neighbour (peer);
if (n != NULL)
{
+#if DEBUG_TRANSPORT_HELLO
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Calling hello_iterate_addresses for %s!\n",
+ GNUNET_i2s (peer));
+#endif
GNUNET_HELLO_iterate_addresses (h,
GNUNET_NO,
&add_to_foreign_address_list,
}
else
{
+#if DEBUG_TRANSPORT_HELLO
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "No existing neighbor record for %s!\n",
+ GNUNET_i2s (peer));
+#endif
GNUNET_STATISTICS_update (stats,
gettext_noop ("# no existing neighbour record (validating HELLO)"),
1,
const struct GNUNET_HELLO_Message *hello;
struct CheckHelloValidatedContext *chvc;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded publicKey;
-#if DEBUG_TRANSPORT_HELLO
+#if DEBUG_TRANSPORT_HELLO > 2
char *my_id;
#endif
hsize = ntohs (message->size);
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&target.hashPubKey);
+#if DEBUG_TRANSPORT_HELLO
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received `%s' message for `%4s'\n",
+ "HELLO",
+ GNUNET_i2s (&target));
+#endif
+
if (0 == memcmp (&my_identity,
&target,
sizeof (struct GNUNET_PeerIdentity)))
chvc->hello,
GNUNET_TIME_absolute_get ()).value > 0)
{
-#if DEBUG_TRANSPORT_HELLO
+#if DEBUG_TRANSPORT_HELLO > 2
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received duplicate `%s' message for `%4s'; ignored\n",
"HELLO",
GNUNET_HELLO_size(hello)));
chvc = chvc->next;
}
-#if DEBUG_TRANSPORT_HELLO
+
+#if BREAK_TESTS
+ struct NeighbourList *temp_neighbor = find_neighbour(&target);
+ if ((NULL != temp_neighbor))
+ {
+ fprintf(stderr, "Already know peer, ignoring hello\n");
+ return GNUNET_OK;
+ }
+#endif
+
+#if DEBUG_TRANSPORT_HELLO > 2
if (plugin != NULL)
{
my_id = GNUNET_strdup(GNUNET_i2s(plugin->env.my_identity));
/* finally, check if HELLO was previously validated
(continuation will then schedule actual validation) */
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# peerinfo iterate requests"),
+ gettext_noop ("# peerinfo process hello iterate requests"),
1,
GNUNET_NO);
GNUNET_STATISTICS_update (stats,
sizeof (struct GNUNET_PeerIdentity)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Received `%s' message not destined for me!\n"),
- "PING");
+ _("Received `%s' message from `%s' destined for `%s' which is not me!\n"),
+ "PING",
+ (sender_address != NULL)
+ ? a2s (plugin->short_name,
+ (const struct sockaddr *)sender_address,
+ sender_address_len)
+ : "<inbound>",
+ GNUNET_i2s (&ping->target));
return GNUNET_SYSERR;
}
#if DEBUG_PING_PONG
obm = (const struct OutboundMessage *) message;
obmm = (const struct GNUNET_MessageHeader *) &obm[1];
msize = size - sizeof (struct OutboundMessage);
-#if DEBUG_TRANSPORT
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' request from client with target `%4s' and message of type %u and size %u\n",
"SEND", GNUNET_i2s (&obm->peer),
ntohs (obmm->type),
msize);
-#endif
+
tcmc = GNUNET_malloc (sizeof (struct TransmitClientMessageContext) + msize);
tcmc->client = client;
tcmc->priority = ntohl (obm->priority);
}
+/**
+ * Handle request connect message
+ *
+ * @param cls closure (always NULL)
+ * @param client identification of the client
+ * @param message the actual message
+ */
+static void
+handle_request_connect (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
+{
+ const struct TransportRequestConnectMessage *trcm =
+ (const struct TransportRequestConnectMessage *) message;
+
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# REQUEST CONNECT messages received"),
+ 1,
+ GNUNET_NO);
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received a request connect message for peer %s\n", GNUNET_i2s(&trcm->peer));
+ setup_peer_check_blacklist (&trcm->peer, GNUNET_YES,
+ NULL, NULL);
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
+}
+
/**
* Handle SET_QUOTA-message.
*
GNUNET_MESSAGE_TYPE_HELLO, 0},
{&handle_send, NULL,
GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 0},
+ {&handle_request_connect, NULL,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT, sizeof(struct TransportRequestConnectMessage)},
{&handle_set_quota, NULL,
GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA, sizeof (struct QuotaSetMessage)},
{&handle_address_lookup, NULL,