if (1 != inet_pton (AF_INET, argv[1], &external))
{
fprintf (stderr,
- "Error parsing IPv4 address: %s\n",
- strerror (errno));
+ "Error parsing IPv4 address: %s\n",
+ strerror (errno));
return 1;
}
if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy))
if (1 == getppid()) /* Check the parent process id, if 1 the parent has died, so we should die too */
break;
if (FD_ISSET (icmpsock, &rs))
- process_icmp_response ();
+ process_icmp_response ();
if (0 == (++alt % 2))
send_icmp_echo (&external);
else
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,
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);
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 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,
return sizeof(struct TransportRequestConnectMessage);
}
+/**
+ * Create and send a request connect message to
+ * the transport service for a particular peer.
+ *
+ * @param h handle to the transport service
+ * @param n the neighbor to send the request connect message about
+ *
+ */
+static void send_request_connect_message(struct GNUNET_TRANSPORT_Handle *h, struct NeighbourList *n)
+{
+ struct TransportRequestConnectMessage *trcm;
+
+ trcm = GNUNET_malloc(sizeof(struct TransportRequestConnectMessage));
+ trcm->header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT);
+ trcm->header.size = htons(sizeof(struct TransportRequestConnectMessage));
+ memcpy(&trcm->peer, &n->id, sizeof(struct GNUNET_PeerIdentity));
+ schedule_control_transmit (h,
+ sizeof (struct TransportRequestConnectMessage),
+ GNUNET_NO,
+ GNUNET_TIME_UNIT_FOREVER_REL, &send_transport_request_connect, trcm);
+}
+
/**
* Add neighbour to our list
*
const struct GNUNET_PeerIdentity *pid)
{
struct NeighbourList *n;
- struct TransportRequestConnectMessage *trcm;
if (GNUNET_YES == h->in_disconnect)
return NULL;
n->h = h;
h->neighbours = n;
- trcm = GNUNET_malloc(sizeof(struct TransportRequestConnectMessage));
- trcm->header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT);
- trcm->header.size = htons(sizeof(struct TransportRequestConnectMessage));
- memcpy(&trcm->peer, pid, sizeof(struct GNUNET_PeerIdentity));
- schedule_control_transmit (h,
- sizeof (struct TransportRequestConnectMessage),
- GNUNET_NO,
- GNUNET_TIME_UNIT_FOREVER_REL, &send_transport_request_connect, trcm);
+
return n;
}
n = neighbour_add (handle, target);
}
+
+ /**
+ * Send a request connect message if not connected,
+ * otherwise we will never send anything to
+ * transport service
+ */
+ if (n->is_connected == GNUNET_NO)
+ {
+ send_request_connect_message(handle, n);
+ }
+
if (n == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
th->priority = priority;
th->notify_delay_task
= GNUNET_SCHEDULER_add_delayed (handle->sched, timeout,
- &peer_transmit_timeout, th);
+ &peer_transmit_timeout, th);
schedule_transmission (handle);
return th;
}