#include "gnunet_protocols.h"
#include "gnunet_service_lib.h"
#include "gnunet_signatures.h"
-#include "plugin_transport.h"
+#include "gnunet_transport_plugin.h"
#include "transport.h"
-#define DEBUG_BLACKLIST GNUNET_NO
+#define DEBUG_BLACKLIST GNUNET_YES
-#define DEBUG_PING_PONG GNUNET_NO
+#define DEBUG_PING_PONG GNUNET_YES
-#define DEBUG_TRANSPORT_HELLO GNUNET_NO
+#define DEBUG_TRANSPORT_HELLO GNUNET_YES
/**
* Should we do some additional checks (to validate behavior
#define MAX_CONNECT_RETRY 3
/**
- * Limit on the number of ready-to-run tasks when validating
- * HELLOs. If more tasks are ready to run, we will drop
+ * Limit on the number of ready-to-run tasks when validating
+ * HELLOs. If more tasks are ready to run, we will drop
* HELLOs instead of validating them.
*/
#define MAX_HELLO_LOAD 4
unsigned int connect_attempts;
/**
- * DV distance to this peer (1 if no DV is used).
+ * DV distance to this peer (1 if no DV is used).
* FIXME: need to set this from transport plugins!
*/
uint32_t distance;
* successfully transmit or receive data to a peer via a particular
* address, we set this to GNUNET_YES. If we later get an error
* (disconnect notification, transmission failure, timeout), we set
- * it back to GNUNET_NO.
+ * it back to GNUNET_NO.
*/
int8_t connected;
* Buffer for at most one payload message used when we receive
* payload data before our PING-PONG has succeeded. We then
* store such messages in this intermediary buffer until the
- * connection is fully up.
+ * connection is fully up.
*/
struct GNUNET_MessageHeader *pre_connect_message_buffer;
unsigned int quota_violation_count;
/**
- * DV distance to this peer (1 if no DV is used).
+ * DV distance to this peer (1 if no DV is used).
*/
uint32_t distance;
*/
int public_key_valid;
+ /**
+ * Performance data for the peer.
+ */
+ struct GNUNET_TRANSPORT_ATS_Information *ats;
+
+ /**
+ * Identity of the neighbour.
+ */
+ struct GNUNET_PeerIdentity peer;
+
};
/**
/**
* Size of address appended to this message (part of what is
- * being signed, hence not redundant).
+ * being signed, hence not redundant).
*/
uint32_t addrlen;
/**
* Current transmit request handle.
- */
+ */
struct GNUNET_CONNECTION_TransmitHandle *th;
/**
* NULL after we are done processing peerinfo's information.
*/
struct GNUNET_PEERINFO_IteratorContext *piter;
-
+
/**
* Was a HELLO known for this peer to peerinfo?
*/
*/
static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key;
-/**
- * Our scheduler.
- */
-struct GNUNET_SCHEDULER_Handle *sched;
-
/**
* Our configuration.
*/
/**
* Find an entry in the neighbour list for a particular peer.
- *
+ *
* @return NULL if not found.
*/
static struct NeighbourList *
plugin = find_transport(transport_name);
if (plugin == NULL) /* Nothing to do */
return;
- if (plugin->blacklist == NULL)
- plugin->blacklist = GNUNET_CONTAINER_multihashmap_create(TRANSPORT_BLACKLIST_HT_SIZE);
+ if (plugin->blacklist == NULL)
+ plugin->blacklist = GNUNET_CONTAINER_multihashmap_create(TRANSPORT_BLACKLIST_HT_SIZE);
GNUNET_assert(plugin->blacklist != NULL);
GNUNET_CONTAINER_multihashmap_put(plugin->blacklist, &peer->hashPubKey,
- NULL,
+ NULL,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
}
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes discarded (could not transmit to client)"),
ntohs (((const struct GNUNET_MessageHeader*)&q[1])->size),
- GNUNET_NO);
+ GNUNET_NO);
GNUNET_CONTAINER_DLL_remove (client->message_queue_head,
client->message_queue_tail,
q);
return p->api->address_to_string (p->api->cls,
addr,
addr_len);
-}
+}
/**
("Dropping message of type %u and size %u, have %u messages pending (%u is the soft limit)\n"),
ntohs (msg->type),
ntohs (msg->size),
- client->message_count,
+ client->message_count,
MAX_PENDING);
GNUNET_STATISTICS_update (stats,
gettext_noop ("# messages dropped due to slow client"),
GNUNET_CONTAINER_DLL_insert_after (client->message_queue_head,
client->message_queue_tail,
client->message_queue_tail,
- q);
+ q);
client->message_count++;
if (client->th == NULL)
{
send_ok_msg.success = htonl (result);
send_ok_msg.latency = GNUNET_TIME_relative_hton (n->latency);
send_ok_msg.peer = n->id;
- transmit_to_client (client, &send_ok_msg.header, GNUNET_NO);
+ transmit_to_client (client, &send_ok_msg.header, GNUNET_NO);
}
*
* @param cls closure, identifies the entry on the
* message queue that was transmitted and the
- * client responsible for queueing the message
+ * client responsible for queuing the message
* @param target the peer receiving the message
* @param result GNUNET_OK on success, if the transmission
* failed, we should not tell the client to transmit
{
struct MessageQueue *mq = cls;
struct NeighbourList *n;
-
+
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes pending with plugins"),
- (int64_t) mq->message_buf_size,
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes successfully transmitted by plugins"),
mq->message_buf_size,
- GNUNET_NO);
+ GNUNET_NO);
}
else
{
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes with transmission failure by plugins"),
mq->message_buf_size,
- GNUNET_NO);
- }
+ GNUNET_NO);
+ }
n = find_neighbour(&mq->neighbour_id);
GNUNET_assert (n != NULL);
if (mq->specific_address != NULL)
{
- if (result == GNUNET_OK)
+ if (result == GNUNET_OK)
{
mq->specific_address->timeout =
GNUNET_TIME_relative_to_absolute
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
if (mq->specific_address->validated == GNUNET_YES)
mark_address_connected (mq->specific_address);
- }
+ }
else
{
if (mq->specific_address->connected != GNUNET_NO)
GNUNET_NO);
mq->specific_address->connected = GNUNET_NO;
}
- }
- if (! mq->internal_msg)
+ }
+ if (! mq->internal_msg)
mq->specific_address->in_transmit = GNUNET_NO;
}
if (mq->client != NULL)
addresses = head->addresses;
while (addresses != NULL)
{
- if ( (addresses->timeout.value < now.value) &&
+ if ( (addresses->timeout.abs_value < now.abs_value) &&
(addresses->connected == GNUNET_YES) )
{
#if DEBUG_TRANSPORT
addresses->in_transmit,
addresses->validated,
addresses->connect_attempts,
- (unsigned long long) addresses->timeout.value,
+ (unsigned long long) addresses->timeout.abs_value,
(unsigned int) addresses->distance);
#endif
- if ( ( (best_address == NULL) ||
+ if ( ( (best_address == NULL) ||
(addresses->connected == GNUNET_YES) ||
(best_address->connected == GNUNET_NO) ) &&
(addresses->in_transmit == GNUNET_NO) &&
- ( (best_address == NULL) ||
- (addresses->latency.value < best_address->latency.value)) )
- best_address = addresses;
+ ( (best_address == NULL) ||
+ (addresses->latency.rel_value < best_address->latency.rel_value)) )
+ best_address = addresses;
/* FIXME: also give lower-latency addresses that are not
connected a chance some times... */
addresses = addresses->next;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Best address found (`%s') has latency of %llu ms.\n",
- (best_address->addrlen > 0)
+ (best_address->addrlen > 0)
? a2s (best_address->ready_list->plugin->short_name,
best_address->addr,
best_address->addrlen)
: "<inbound>",
- best_address->latency.value);
+ best_address->latency.rel_value);
#endif
}
else
force_address = GNUNET_YES;
if (mq->specific_address == NULL)
{
- mq->specific_address = find_ready_address(neighbour);
+ mq->specific_address = find_ready_address(neighbour);
GNUNET_STATISTICS_update (stats,
gettext_noop ("# transport selected peer address freely"),
1,
- GNUNET_NO);
+ GNUNET_NO);
force_address = GNUNET_NO;
}
if (mq->specific_address == NULL)
GNUNET_STATISTICS_update (stats,
gettext_noop ("# transport failed to selected peer address"),
1,
- GNUNET_NO);
+ GNUNET_NO);
timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout);
- if (timeout.value == 0)
+ if (timeout.rel_value == 0)
{
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes discarded (no destination address available)"),
mq->message_buf_size,
- GNUNET_NO);
+ GNUNET_NO);
if (mq->client != NULL)
transmit_send_ok (mq->client, neighbour, GNUNET_NO);
GNUNET_CONTAINER_DLL_remove (neighbour->messages_head,
neighbour->messages_tail,
mq);
GNUNET_free (mq);
- return; /* nobody ready */
+ return; /* nobody ready */
}
GNUNET_STATISTICS_update (stats,
gettext_noop ("# message delivery deferred (no address)"),
1,
GNUNET_NO);
if (neighbour->retry_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (sched,
- neighbour->retry_task);
- neighbour->retry_task = GNUNET_SCHEDULER_add_delayed (sched,
- timeout,
+ GNUNET_SCHEDULER_cancel (neighbour->retry_task);
+ neighbour->retry_task = GNUNET_SCHEDULER_add_delayed (timeout,
&retry_transmission_task,
neighbour);
#if DEBUG_TRANSPORT
"No validated destination address available to transmit message of size %u to peer `%4s', will wait %llums to find an address.\n",
mq->message_buf_size,
GNUNET_i2s (&mq->neighbour_id),
- timeout.value);
+ timeout.rel_value);
#endif
/* FIXME: might want to trigger peerinfo lookup here
(unless that's already pending...) */
- return;
+ return;
}
GNUNET_CONTAINER_DLL_remove (neighbour->messages_head,
neighbour->messages_tail,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending message of size %u for `%4s' to `%s' via plugin `%s'\n",
mq->message_buf_size,
- GNUNET_i2s (&neighbour->id),
+ GNUNET_i2s (&neighbour->id),
(mq->specific_address->addr != NULL)
? a2s (mq->plugin->short_name,
mq->specific_address->addr,
{
/* failure, but 'send' would not call continuation in this case,
so we need to do it here! */
- transmit_send_continuation (mq,
+ transmit_send_continuation (mq,
&mq->neighbour_id,
GNUNET_SYSERR);
}
mq->internal_msg = is_internal;
mq->priority = priority;
mq->timeout = GNUNET_TIME_relative_to_absolute (timeout);
- if (is_internal)
+ if (is_internal)
GNUNET_CONTAINER_DLL_insert (neighbour->messages_head,
neighbour->messages_tail,
mq);
GNUNET_NO);
transmit_to_peer (NULL, NULL, 0,
HELLO_ADDRESS_EXPIRATION,
- (const char *) our_hello,
+ (const char *) our_hello,
GNUNET_HELLO_size(our_hello),
GNUNET_NO, npos);
npos = npos->next;
* expired
*/
static void
-update_addresses (struct TransportPlugin *plugin, int fresh)
+update_addresses (struct TransportPlugin *plugin,
+ int fresh)
{
static struct GNUNET_TIME_Absolute last_update;
struct GNUNET_TIME_Relative min_remaining;
int expired;
if (plugin->address_update_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (plugin->env.sched, plugin->address_update_task);
+ GNUNET_SCHEDULER_cancel (plugin->address_update_task);
plugin->address_update_task = GNUNET_SCHEDULER_NO_TASK;
now = GNUNET_TIME_absolute_get ();
min_remaining = GNUNET_TIME_UNIT_FOREVER_REL;
- expired = (GNUNET_TIME_absolute_get_duration (last_update).value > (HELLO_ADDRESS_EXPIRATION.value / 4));
+ expired = (GNUNET_TIME_absolute_get_duration (last_update).rel_value > (HELLO_ADDRESS_EXPIRATION.rel_value / 4));
prev = NULL;
pos = plugin->addresses;
while (pos != NULL)
{
next = pos->next;
- if (pos->expires.value < now.value)
+ if (pos->expires.abs_value < now.abs_value)
{
expired = GNUNET_YES;
if (prev == NULL)
plugin->addresses = pos->next;
else
- prev->next = pos->next;
+ prev->next = pos->next;
GNUNET_free (pos);
}
else
{
remaining = GNUNET_TIME_absolute_get_remaining (pos->expires);
- if (remaining.value < min_remaining.value)
+ if (remaining.rel_value < min_remaining.rel_value)
min_remaining = remaining;
prev = pos;
}
GNUNET_TIME_relative_divide (HELLO_ADDRESS_EXPIRATION,
2));
plugin->address_update_task
- = GNUNET_SCHEDULER_add_delayed (plugin->env.sched,
- min_remaining,
+ = GNUNET_SCHEDULER_add_delayed (min_remaining,
&expire_address_task, plugin);
}
* @param value value in the hash map ('struct ValidationEntry*')
* @return GNUNET_YES (we should continue to iterate)
*/
-static int
+static int
remove_session_validations (void *cls,
const GNUNET_HashCode * key,
void *value)
/**
* We've been disconnected from the other peer (for some
- * connection-oriented transport). Either quickly
+ * connection-oriented transport). Either quickly
* re-establish the connection or signal the disconnect
* to the CORE.
*
1) ideally: our own willingness / need to connect
2) prior failures to connect to this peer (by plugin)
3) ideally: reasons why other peer terminated (as far as knowable)
-
+
Most importantly, it must be POSSIBLE for another peer to terminate
a connection for a while (without us instantly re-establishing it).
Similarly, if another peer is gone we should quickly notify CORE.
on the other end), we should reconnect in such a way that BOTH CORE
services never even notice.
Furthermore, the same mechanism (or small variation) could be used
- to switch to a better-performing plugin (ATS).
+ to switch to a better-performing plugin (ATS).
Finally, this needs to be tested throughly... */
* discard all of those sessions as well. Plugins that do not
* use sessions can simply omit calling this function and always
* use NULL wherever a session pointer is needed.
- *
+ *
* @param cls closure
- * @param peer which peer was the session for
+ * @param peer which peer was the session for
* @param session which session is being destoyed
*/
static void
prev->next = pos->next;
if (GNUNET_SCHEDULER_NO_TASK != pos->revalidate_task)
{
- GNUNET_SCHEDULER_cancel (sched,
- pos->revalidate_task);
+ GNUNET_SCHEDULER_cancel (pos->revalidate_task);
pos->revalidate_task = GNUNET_SCHEDULER_NO_TASK;
}
GNUNET_free (pos);
while (al != NULL)
{
if ((addrlen == al->addrlen) && (0 == memcmp (addr, &al[1], addrlen)))
- {
- if (al->expires.value < abex.value)
- al->expires = abex;
+ {
+ al->expires = abex;
+ update_addresses (p, GNUNET_NO);
return;
}
al = al->next;
static void
notify_clients_connect (const struct GNUNET_PeerIdentity *peer,
struct GNUNET_TIME_Relative latency,
- uint32_t distance)
+ uint32_t distance)
{
- struct ConnectInfoMessage cim;
+ struct ConnectInfoMessage * cim;
struct TransportClient *cpos;
+ uint32_t ats_count;
+ size_t size;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
gettext_noop ("# peers connected"),
1,
GNUNET_NO);
- cim.header.size = htons (sizeof (struct ConnectInfoMessage));
- cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
- cim.distance = htonl (distance);
- cim.latency = GNUNET_TIME_relative_hton (latency);
- memcpy (&cim.id, peer, sizeof (struct GNUNET_PeerIdentity));
+
+ ats_count = 2;
+ size = sizeof (struct ConnectInfoMessage) + ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information);
+ if (size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ {
+ GNUNET_break(0);
+ }
+ cim = GNUNET_malloc (size);
+
+ cim->header.size = htons (size);
+ cim->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
+ cim->ats_count = htonl(2);
+ (&(cim->ats))[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ (&(cim->ats))[0].value = htonl (distance);
+ (&(cim->ats))[1].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
+ (&(cim->ats))[1].value = htonl ((uint32_t) latency.rel_value);
+ (&(cim->ats))[2].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ (&(cim->ats))[2].value = htonl (0);
+ memcpy (&cim->id, peer, sizeof (struct GNUNET_PeerIdentity));
cpos = clients;
while (cpos != NULL)
{
- transmit_to_client (cpos, &cim.header, GNUNET_NO);
+ transmit_to_client (cpos, &(cim->header), GNUNET_NO);
cpos = cpos->next;
}
+ GNUNET_free (cim);
}
add_peer_address (struct NeighbourList *neighbour,
const char *tname,
struct Session *session,
- const char *addr,
+ const char *addr,
uint16_t addrlen)
{
struct ReadyList *head;
ret->latency = GNUNET_TIME_relative_get_forever();
ret->distance = -1;
ret->timeout = GNUNET_TIME_relative_to_absolute
- (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+ (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
ret->ready_list = head;
ret->next = head->addresses;
head->addresses = ret;
* @param value value in the hash map (validation to abort)
* @return GNUNET_YES (always)
*/
-static int
+static int
abort_validation (void *cls,
const GNUNET_HashCode * key,
void *value)
struct ValidationEntry *va = value;
if (GNUNET_SCHEDULER_NO_TASK != va->timeout_task)
- GNUNET_SCHEDULER_cancel (sched, va->timeout_task);
+ GNUNET_SCHEDULER_cancel (va->timeout_task);
GNUNET_free (va->transport_name);
if (va->chvc != NULL)
{
GNUNET_STATISTICS_update (stats,
gettext_noop ("# valid peer addresses returned by PEERINFO"),
1,
- GNUNET_NO);
+ GNUNET_NO);
try = GNUNET_NO;
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),
tname,
GNUNET_i2s (&n->id),
- expiration.value);
+ expiration.abs_value);
#endif
fal = add_peer_address (n, tname, NULL, addr, addrlen);
if (fal == NULL)
GNUNET_STATISTICS_update (stats,
gettext_noop ("# previously validated addresses lacking transport"),
1,
- GNUNET_NO);
+ GNUNET_NO);
}
else
{
}
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 (fal->validated == GNUNET_NO)
{
- fal->validated = GNUNET_YES;
+ fal->validated = GNUNET_YES;
GNUNET_STATISTICS_update (stats,
gettext_noop ("# peer addresses considered valid"),
1,
- GNUNET_NO);
+ GNUNET_NO);
}
if (try == GNUNET_YES)
{
GNUNET_NO);
n->piter = NULL;
return;
- }
+ }
if (h == NULL)
return; /* no HELLO available */
#if DEBUG_TRANSPORT
/**
* Create a fresh entry in our neighbour list for the given peer.
- * Will try to transmit our current HELLO to the new neighbour.
+ * Will try to transmit our current HELLO to the new neighbour.
* Do not call this function directly, use 'setup_peer_check_blacklist.
*
* @param peer the peer for which we create the entry
}
n->latency = GNUNET_TIME_UNIT_FOREVER_REL;
n->distance = -1;
- n->timeout_task = GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ n->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
&neighbour_timeout_task, n);
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->piter = GNUNET_PEERINFO_iterate (peerinfo, peer,
GNUNET_TIME_UNIT_FOREVER_REL,
&add_hello_for_peer, n);
+
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# HELLO's sent to new neighbors"),
+ 1,
+ GNUNET_NO);
transmit_to_peer (NULL, NULL, 0,
HELLO_ADDRESS_EXPIRATION,
(const char *) our_hello, GNUNET_HELLO_size(our_hello),
/**
* Function called after we have checked if communicating
- * with a given peer is acceptable.
+ * with a given peer is acceptable.
*
* @param cls closure
* @param n NULL if communication is not acceptable
*/
struct BlacklistCheck
{
-
+
/**
* This is a linked list.
*/
struct BlacklistCheck *next;
-
+
/**
* This is a linked list.
*/
* Perform next action in the blacklist check.
*
* @param cls the 'struct BlacklistCheck*'
- * @param tc unused
+ * @param tc unused
*/
static void
do_blacklist_check (void *cls,
if (size == 0)
{
GNUNET_assert (bc->task == GNUNET_SCHEDULER_NO_TASK);
- bc->task = GNUNET_SCHEDULER_add_now (sched,
- &do_blacklist_check,
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
bc);
return 0;
}
bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY);
bm.is_allowed = htonl (0);
bm.peer = bc->peer;
- memcpy (buf, &bm, sizeof (bm));
+ memcpy (buf, &bm, sizeof (bm));
GNUNET_SERVER_receive_done (bl->client, GNUNET_OK);
return sizeof (bm);
}
* Perform next action in the blacklist check.
*
* @param cls the 'struct BlacklistCheck*'
- * @param tc unused
+ * @param tc unused
*/
static void
do_blacklist_check (void *cls,
GNUNET_free (bc);
return;
}
- if (bl->bc == NULL)
+ if (bl->bc == NULL)
{
bl->bc = bc;
bc->th = GNUNET_SERVER_notify_transmit_ready (bl->client,
sizeof (struct BlacklistMessage),
GNUNET_TIME_UNIT_FOREVER_REL,
&transmit_blacklist_message,
- bc);
+ bc);
}
}
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));
bc->cont = cont;
bc->cont_cls = cont_cls;
bc->bl_pos = bl_head;
- bc->task = GNUNET_SCHEDULER_add_now (sched,
- &do_blacklist_check,
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
bc);
}
/**
- * Function called with the result of querying a new blacklister about
+ * Function called with the result of querying a new blacklister about
* it being allowed (or not) to continue to talk to an existing neighbour.
*
* @param cls the original 'struct NeighbourList'
bc->bl_pos = bl;
if (n == neighbours) /* all would wait for the same client, no need to
create more than just the first task right now */
- bc->task = GNUNET_SCHEDULER_add_now (sched,
- &do_blacklist_check,
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
bc);
n = n->next;
}
bl = bl_head;
while ( (bl != NULL) &&
(bl->client != client) )
- bl = bl->next;
+ bl = bl->next;
if (bl == NULL)
{
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
bc = bl->bc;
- bl->bc = NULL;
+ bl->bc = NULL;
if (ntohl (msg->is_allowed) == GNUNET_SYSERR)
- {
+ {
bc->cont (bc->cont_cls, NULL);
GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc);
GNUNET_free (bc);
else
{
bc->bl_pos = bc->bl_pos->next;
- bc->task = GNUNET_SCHEDULER_add_now (sched,
- &do_blacklist_check,
- bc);
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
+ bc);
}
/* check if any other bc's are waiting for this blacklister */
bc = bc_head;
{
if ( (bc->bl_pos == bl) &&
(GNUNET_SCHEDULER_NO_TASK == bc->task) )
- bc->task = GNUNET_SCHEDULER_add_now (sched,
- &do_blacklist_check,
- bc);
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
+ bc);
bc = bc->next;
}
}
* @param cls our 'struct PeriodicValidationContext*'
* @param tc task context
*/
-static void
-send_periodic_ping (void *cls,
+static void
+send_periodic_ping (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct ForeignAddressList *peer_address = cls;
peer_address->revalidate_task = GNUNET_SCHEDULER_NO_TASK;
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
- return;
+ return;
tp = peer_address->ready_list->plugin;
neighbour = peer_address->ready_list->neighbour;
if (GNUNET_YES != neighbour->public_key_valid)
{
/* no public key yet, try again later */
- schedule_next_ping (peer_address);
+ schedule_next_ping (peer_address);
return;
}
caec.addr = peer_address->addr;
tp->short_name,
GNUNET_i2s (&neighbour->id));
#endif
- schedule_next_ping (peer_address);
+ schedule_next_ping (peer_address);
return;
}
va = GNUNET_malloc (sizeof (struct ValidationEntry) + peer_address->addrlen);
va->transport_name = GNUNET_strdup (tp->short_name);
- va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+ va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
UINT_MAX);
va->send_time = GNUNET_TIME_absolute_get();
va->session = peer_address->session;
va->addrlen = peer_address->addrlen;
}
memcpy(&va->publicKey,
- &neighbour->publicKey,
+ &neighbour->publicKey,
sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
- va->timeout_task = GNUNET_SCHEDULER_add_delayed (sched,
- HELLO_VERIFICATION_TIMEOUT,
+ va->timeout_task = GNUNET_SCHEDULER_add_delayed (HELLO_VERIFICATION_TIMEOUT,
&timeout_hello_validation,
va);
GNUNET_CONTAINER_multihashmap_put (validation_map,
&neighbour->id.hashPubKey,
va,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
- hello_size = GNUNET_HELLO_size(our_hello);
+
+ if (peer_address->validated != GNUNET_YES)
+ hello_size = GNUNET_HELLO_size(our_hello);
+ else
+ hello_size = 0;
+
tsize = sizeof(struct TransportPingMessage) + hello_size;
+
if (peer_address->addr != NULL)
{
slen = strlen (tp->short_name) + 1;
ping.header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_PING);
ping.challenge = htonl(va->challenge);
memcpy(&ping.target, &neighbour->id, sizeof(struct GNUNET_PeerIdentity));
- memcpy(message_buf, our_hello, hello_size);
+ if (peer_address->validated != GNUNET_YES)
+ {
+ memcpy(message_buf, our_hello, hello_size);
+ }
+
if (peer_address->addr != NULL)
{
- ping.header.size = htons(sizeof(struct TransportPingMessage) +
- peer_address->addrlen +
+ ping.header.size = htons(sizeof(struct TransportPingMessage) +
+ peer_address->addrlen +
slen);
memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage)],
- tp->short_name,
+ tp->short_name,
slen);
memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage) + slen],
- peer_address->addr,
+ peer_address->addr,
peer_address->addrlen);
}
else
{
ping.header.size = htons(sizeof(struct TransportPingMessage));
}
+
memcpy(&message_buf[hello_size],
&ping,
sizeof(struct TransportPingMessage));
#if DEBUG_TRANSPORT_REVALIDATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Performing re-validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s'\n",
- (peer_address->addr != NULL)
+ (peer_address->addr != NULL)
? a2s (peer_address->plugin->short_name,
peer_address->addr,
peer_address->addrlen)
"HELLO", hello_size,
"PING");
#endif
+ if (peer_address->validated != GNUNET_YES)
+ GNUNET_STATISTICS_update (stats,
+ 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);
GNUNET_STATISTICS_update (stats,
gettext_noop ("# PING messages sent for re-validation"),
1,
if (fal->revalidate_task != GNUNET_SCHEDULER_NO_TASK)
return;
delay = GNUNET_TIME_absolute_get_remaining (fal->expires);
- delay.value /= 2; /* do before expiration */
+ delay.rel_value /= 2; /* do before expiration */
delay = GNUNET_TIME_relative_min (delay,
LATENCY_EVALUATION_MAX_DELAY);
if (GNUNET_YES != fal->estimated)
{
delay = GNUNET_TIME_UNIT_ZERO;
fal->estimated = GNUNET_YES;
- }
+ }
if (GNUNET_YES == fal->connected)
{
delay = GNUNET_TIME_relative_min (delay,
CONNECTED_LATENCY_EVALUATION_MAX_DELAY);
- }
+ }
/* FIXME: also adjust delay based on how close the last
observed latency is to the latency of the best alternative */
/* bound how fast we can go */
delay = GNUNET_TIME_relative_max (delay,
GNUNET_TIME_UNIT_SECONDS);
/* randomize a bit (to avoid doing all at the same time) */
- delay.value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000);
- fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched,
- delay,
- &send_periodic_ping,
+ delay.rel_value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000);
+ fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(delay,
+ &send_periodic_ping,
fal);
}
*/
static void
handle_payload_message (const struct GNUNET_MessageHeader *message,
- struct NeighbourList *n)
+ struct NeighbourList *n)
{
struct InboundMessage *im;
struct TransportClient *cpos;
}
#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),
+ ntohs (message->type),
+ ntohs (message->size),
GNUNET_i2s (&n->id));
#endif
if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker,
{
n->quota_violation_count++;
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Bandwidth quota (%u b/s) violation detected (total of %u).\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Bandwidth quota (%u b/s) violation detected (total of %u).\n",
n->in_tracker.available_bytes_per_s__,
n->quota_violation_count);
#endif
GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker,
- 32 * 1024);
}
- else
+ else
{
if (n->quota_violation_count > 0)
{
msize,
GNUNET_NO);
/* transmit message to all clients */
- im = GNUNET_malloc (sizeof (struct InboundMessage) + msize);
- im->header.size = htons (sizeof (struct InboundMessage) + msize);
+ uint32_t ats_count = 2;
+ size_t size = sizeof (struct InboundMessage) + ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + msize;
+ if (size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ GNUNET_break(0);
+
+ im = GNUNET_malloc (size);
+ im->header.size = htons (size);
im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
- im->latency = GNUNET_TIME_relative_hton (n->latency);
im->peer = n->id;
- im->distance = ntohl(n->distance);
- memcpy (&im[1], message, msize);
+ im->ats_count = htonl(ats_count);
+ /* Setting ATS data */
+ (&(im->ats))[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ (&(im->ats))[0].value = htonl (n->distance);
+ (&(im->ats))[1].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
+ (&(im->ats))[1].value = htonl ((uint32_t) n->latency.rel_value);
+ (&(im->ats))[ats_count].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ (&(im->ats))[ats_count].value = htonl (0);
+
+ memcpy (&((&(im->ats))[ats_count+1]), message, msize);
cpos = clients;
while (cpos != NULL)
{
}
addr = (const char*) &pong[1];
slen = strlen (ve->transport_name) + 1;
- if ( (ps - sizeof (struct TransportPongMessage) != ve->addrlen + slen) ||
+ if ( (ps - sizeof (struct TransportPongMessage) < slen) ||
(ve->challenge != challenge) ||
(addr[slen-1] != '\0') ||
- (0 != strcmp (addr, ve->transport_name)) ||
- (ntohl (pong->purpose.size)
+ (0 != strcmp (addr, ve->transport_name)) ||
+ (ntohl (pong->purpose.size)
!= sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) +
sizeof (uint32_t) +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
- sizeof (struct GNUNET_PeerIdentity) + ve->addrlen + slen) )
+ sizeof (struct GNUNET_PeerIdentity) + ps - sizeof (struct TransportPongMessage)) )
{
return GNUNET_YES;
}
}
if (0 != memcmp (&pong->pid,
key,
- sizeof (struct GNUNET_PeerIdentity)))
+ sizeof (struct GNUNET_PeerIdentity)))
{
GNUNET_break_op (0);
return GNUNET_NO;
}
if (GNUNET_OK !=
GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
- &pong->purpose,
+ &pong->purpose,
&pong->signature,
- &ve->publicKey))
+ &ve->publicKey))
{
GNUNET_break_op (0);
return GNUNET_NO;
}
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Confirmed validity of address, peer `%4s' has address `%s' (%s).\n",
- GNUNET_h2s (key),
- a2s (ve->transport_name,
- (const struct sockaddr *) ve->addr,
- ve->addrlen),
- ve->transport_name);
+
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Confirmed validity of address, peer `%4s' has address `%s' (%s).\n",
#endif
break;
case GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING:
- if (ve->addrlen != 0)
- {
- return GNUNET_YES; /* different entry, keep trying */
- }
- if ( (0 != memcmp (&pong->pid,
+ if (0 != memcmp (&pong->pid,
&my_identity,
- sizeof (struct GNUNET_PeerIdentity))) ||
- (ve->addrlen != 0) )
+ sizeof (struct GNUNET_PeerIdentity)))
{
GNUNET_break_op (0);
return GNUNET_NO;
}
+ if (ve->addrlen != 0)
+ {
+ /* must have been for a different validation entry */
+ return GNUNET_YES;
+ }
tp = find_transport (ve->transport_name);
if (tp == NULL)
{
a2s (ve->transport_name,
&addr[slen],
alen));
- return GNUNET_NO;
+ return GNUNET_NO;
}
if (GNUNET_OK !=
GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING,
- &pong->purpose,
+ &pong->purpose,
&pong->signature,
- &ve->publicKey))
+ &ve->publicKey))
{
GNUNET_break_op (0);
return GNUNET_NO;
GNUNET_break_op (0);
return GNUNET_NO;
}
- if (GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (pong->expiration)).value == 0)
+ if (GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value == 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Received expired signature. Check system time.\n"));
GNUNET_STATISTICS_update (stats,
gettext_noop ("# peer addresses considered valid"),
1,
- GNUNET_NO);
+ GNUNET_NO);
fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time);
schedule_next_ping (fal);
- if (n->latency.value == GNUNET_TIME_UNIT_FOREVER_REL.value)
+ if (n->latency.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
n->latency = fal->latency;
else
- n->latency.value = (fal->latency.value + n->latency.value) / 2;
+ n->latency.rel_value = (fal->latency.rel_value + n->latency.rel_value) / 2;
n->distance = fal->distance;
if (GNUNET_NO == n->received_pong)
}
if (n->retry_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched,
- n->retry_task);
+ GNUNET_SCHEDULER_cancel (n->retry_task);
n->retry_task = GNUNET_SCHEDULER_NO_TASK;
try_transmission_to_peer (n);
}
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to add peer `%4s' for plugin `%s'\n",
- GNUNET_i2s (&neighbour->id),
+ GNUNET_i2s (&neighbour->id),
va->transport_name);
GNUNET_break (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_remove (validation_map,
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Performing validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s' (%u bytes)\n",
- (va->addrlen == 0)
+ (va->addrlen == 0)
? "<inbound>"
: a2s (va->transport_name,
(const void*) &va[1], va->addrlen),
GNUNET_STATISTICS_update (stats,
gettext_noop ("# PING messages sent for initial validation"),
1,
- GNUNET_NO);
+ GNUNET_NO);
transmit_to_peer (NULL, peer_address,
GNUNET_SCHEDULER_PRIORITY_DEFAULT,
HELLO_VERIFICATION_TIMEOUT,
run_validation (void *cls,
const char *tname,
struct GNUNET_TIME_Absolute expiration,
- const void *addr,
+ const void *addr,
uint16_t addrlen)
{
struct CheckHelloValidatedContext *chvc = cls;
GNUNET_STATISTICS_update (stats,
gettext_noop ("# peer addresses scheduled for validation"),
1,
- GNUNET_NO);
+ GNUNET_NO);
tp = find_transport (tname);
if (tp == NULL)
{
GNUNET_STATISTICS_update (stats,
gettext_noop ("# peer addresses not validated (plugin not available)"),
1,
- GNUNET_NO);
+ GNUNET_NO);
return GNUNET_OK;
}
/* check if this is one of our own addresses */
GNUNET_STATISTICS_update (stats,
gettext_noop ("# peer addresses not validated (loopback)"),
1,
- GNUNET_NO);
+ GNUNET_NO);
return GNUNET_OK;
}
oal = oal->next;
{
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Attempted to validate blacklisted peer `%s' using `%s'!\n",
- GNUNET_i2s(&id),
+ "Attempted to validate blacklisted peer `%s' using `%s'!\n",
+ GNUNET_i2s(&id),
tname);
#endif
return GNUNET_OK;
GNUNET_STATISTICS_update (stats,
gettext_noop ("# peer addresses not validated (in progress)"),
1,
- GNUNET_NO);
+ GNUNET_NO);
return GNUNET_OK;
}
va = GNUNET_malloc (sizeof (struct ValidationEntry) + addrlen);
va->chvc = chvc;
chvc->ve_count++;
va->transport_name = GNUNET_strdup (tname);
- va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+ va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
UINT_MAX);
va->send_time = GNUNET_TIME_absolute_get();
va->addr = (const void*) &va[1];
va->addrlen = addrlen;
GNUNET_HELLO_get_key (chvc->hello,
&va->publicKey);
- va->timeout_task = GNUNET_SCHEDULER_add_delayed (sched,
- HELLO_VERIFICATION_TIMEOUT,
+ va->timeout_task = GNUNET_SCHEDULER_add_delayed (HELLO_VERIFICATION_TIMEOUT,
&timeout_hello_validation,
va);
GNUNET_CONTAINER_multihashmap_put (validation_map,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&target.hashPubKey);
plain_hello = GNUNET_HELLO_create (&pk,
- NULL,
+ NULL,
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",
GNUNET_STATISTICS_update (stats,
gettext_noop ("# new HELLOs requiring full validation"),
1,
- GNUNET_NO);
+ GNUNET_NO);
GNUNET_HELLO_iterate_addresses (chvc->hello,
- GNUNET_NO,
- &run_validation,
+ GNUNET_NO,
+ &run_validation,
chvc);
}
else
GNUNET_STATISTICS_update (stats,
gettext_noop ("# duplicate HELLO (peer known)"),
1,
- GNUNET_NO);
+ GNUNET_NO);
}
chvc->ve_count--;
if (chvc->ve_count == 0)
GNUNET_CONTAINER_DLL_remove (chvc_head,
chvc_tail,
chvc);
- GNUNET_free (chvc);
+ GNUNET_free (chvc);
}
return;
- }
+ }
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,
- GNUNET_NO);
+ GNUNET_NO);
}
GNUNET_STATISTICS_update (stats,
gettext_noop ("# HELLO validations (update case)"),
1,
- GNUNET_NO);
+ GNUNET_NO);
GNUNET_HELLO_iterate_new_addresses (chvc->hello,
h,
GNUNET_TIME_relative_to_absolute (HELLO_REVALIDATION_START_TIME),
- &run_validation,
+ &run_validation,
chvc);
}
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);
GNUNET_STATISTICS_update (stats,
gettext_noop ("# HELLOs received for validation"),
1,
- GNUNET_NO);
+ GNUNET_NO);
/* first, check if load is too high */
- if (GNUNET_SCHEDULER_get_load (sched,
- GNUNET_SCHEDULER_PRIORITY_BACKGROUND) > MAX_HELLO_LOAD)
+ if (GNUNET_SCHEDULER_get_load (GNUNET_SCHEDULER_PRIORITY_BACKGROUND) > MAX_HELLO_LOAD)
{
GNUNET_STATISTICS_update (stats,
gettext_noop ("# HELLOs ignored due to high load"),
1,
- GNUNET_NO);
+ GNUNET_NO);
#if DEBUG_TRANSPORT_HELLO
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Ignoring `%s' for `%4s', load too high.\n",
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)))
GNUNET_STATISTICS_update (stats,
gettext_noop ("# HELLOs ignored for validation (is my own HELLO)"),
1,
- GNUNET_NO);
- return GNUNET_OK;
+ GNUNET_NO);
+ return GNUNET_OK;
}
chvc = chvc_head;
while (NULL != chvc)
{
if (GNUNET_HELLO_equals (hello,
chvc->hello,
- GNUNET_TIME_absolute_get ()).value > 0)
+ GNUNET_TIME_absolute_get ()).abs_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",
+ "HELLO",
GNUNET_i2s (&target));
#endif
return GNUNET_OK; /* validation already pending */
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,
GNUNET_STATISTICS_update (stats,
gettext_noop ("# connected addresses"),
-1,
- GNUNET_NO);
+ GNUNET_NO);
if (GNUNET_YES == peer_pos->validated)
GNUNET_STATISTICS_update (stats,
gettext_noop ("# peer addresses considered valid"),
-1,
- GNUNET_NO);
+ GNUNET_NO);
if (GNUNET_SCHEDULER_NO_TASK != peer_pos->revalidate_task)
{
- GNUNET_SCHEDULER_cancel (sched,
- peer_pos->revalidate_task);
+ GNUNET_SCHEDULER_cancel (peer_pos->revalidate_task);
peer_pos->revalidate_task = GNUNET_SCHEDULER_NO_TASK;
}
GNUNET_free(peer_pos);
GNUNET_CONTAINER_DLL_remove (n->messages_head,
n->messages_tail,
mq);
- GNUNET_assert (0 == memcmp(&mq->neighbour_id,
+ GNUNET_assert (0 == memcmp(&mq->neighbour_id,
&n->id,
sizeof(struct GNUNET_PeerIdentity)));
GNUNET_free (mq);
}
if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched, n->timeout_task);
+ GNUNET_SCHEDULER_cancel (n->timeout_task);
n->timeout_task = GNUNET_SCHEDULER_NO_TASK;
}
if (n->retry_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched, n->retry_task);
+ GNUNET_SCHEDULER_cancel (n->retry_task);
n->retry_task = GNUNET_SCHEDULER_NO_TASK;
}
if (n->piter != NULL)
/**
* We have received a PING message from someone. Need to send a PONG message
- * in response to the peer by any means necessary.
+ * in response to the peer by any means necessary.
*/
-static int
+static int
handle_ping(void *cls, const struct GNUNET_MessageHeader *message,
const struct GNUNET_PeerIdentity *peer,
struct Session *session,
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
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
"Processing `%s' from `%s'\n",
- "PING",
- (sender_address != NULL)
+ "PING",
+ (sender_address != NULL)
? a2s (plugin->short_name,
- (const struct sockaddr *)sender_address,
+ (const struct sockaddr *)sender_address,
sender_address_len)
: "<inbound>");
#endif
alen = ntohs (message->size) - sizeof (struct TransportPingMessage);
slen = strlen (plugin->short_name) + 1;
if (alen == 0)
- {
+ {
/* peer wants to confirm that we have an outbound connection to him */
if (session == NULL)
{
pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING);
pong->challenge = ping->challenge;
pong->addrlen = htonl(sender_address_len + slen);
- memcpy(&pong->pid,
+ memcpy(&pong->pid,
peer,
sizeof(struct GNUNET_PeerIdentity));
- memcpy (&pong[1],
- plugin->short_name,
+ memcpy (&pong[1],
+ plugin->short_name,
slen);
- memcpy (&((char*)&pong[1])[slen],
- sender_address,
+ memcpy (&((char*)&pong[1])[slen],
+ sender_address,
sender_address_len);
- if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires).value < PONG_SIGNATURE_LIFETIME.value / 4)
+ if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires).rel_value < PONG_SIGNATURE_LIFETIME.rel_value / 4)
{
/* create / update cached sig */
#if DEBUG_TRANSPORT
}
memcpy (&pong->signature,
&session_header->pong_signature,
- sizeof (struct GNUNET_CRYPTO_RsaSignature));
+ sizeof (struct GNUNET_CRYPTO_RsaSignature));
}
pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN);
pong->challenge = ping->challenge;
pong->addrlen = htonl(alen + slen);
- memcpy(&pong->pid,
- &my_identity,
+ memcpy(&pong->pid,
+ &my_identity,
sizeof(struct GNUNET_PeerIdentity));
memcpy (&pong[1], plugin->short_name, slen);
memcpy (&((char*)&pong[1])[slen], addr, alen);
if ( (oal != NULL) &&
- (GNUNET_TIME_absolute_get_remaining (oal->pong_sig_expires).value < PONG_SIGNATURE_LIFETIME.value / 4) )
+ (GNUNET_TIME_absolute_get_remaining (oal->pong_sig_expires).rel_value < PONG_SIGNATURE_LIFETIME.rel_value / 4) )
{
/* create / update cached sig */
#if DEBUG_TRANSPORT
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_rsa_sign (my_private_key,
&pong->purpose,
- &oal->pong_signature));
+ &oal->pong_signature));
memcpy (&pong->signature,
&oal->pong_signature,
- sizeof (struct GNUNET_CRYPTO_RsaSignature));
+ sizeof (struct GNUNET_CRYPTO_RsaSignature));
}
else if (oal == NULL)
{
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_rsa_sign (my_private_key,
&pong->purpose,
- &pong->signature));
+ &pong->signature));
}
else
{
pong->expiration = GNUNET_TIME_absolute_hton (oal->pong_sig_expires);
memcpy (&pong->signature,
&oal->pong_signature,
- sizeof (struct GNUNET_CRYPTO_RsaSignature));
+ sizeof (struct GNUNET_CRYPTO_RsaSignature));
}
}
n = find_neighbour(peer);
peer,
(const char*) pong,
ntohs (pong->header.size),
- TRANSPORT_PONG_PRIORITY,
+ TRANSPORT_PONG_PRIORITY,
HELLO_VERIFICATION_TIMEOUT,
fal->session,
fal->addr,
GNUNET_STATISTICS_update (stats,
gettext_noop ("# PONGs unicast via reliable transport"),
1,
- GNUNET_NO);
+ GNUNET_NO);
GNUNET_free (pong);
return GNUNET_OK;
}
GNUNET_STATISTICS_update (stats,
gettext_noop ("# PONGs multicast to all available addresses"),
1,
- GNUNET_NO);
+ GNUNET_NO);
rl = n->plugins;
while (rl != NULL)
{
while (fal != NULL)
{
transmit_to_peer(NULL, fal,
- TRANSPORT_PONG_PRIORITY,
+ TRANSPORT_PONG_PRIORITY,
HELLO_VERIFICATION_TIMEOUT,
- (const char *)pong,
- ntohs(pong->header.size),
- GNUNET_YES,
+ (const char *)pong,
+ ntohs(pong->header.size),
+ GNUNET_YES,
n);
fal = fal->next;
}
* @param session identifier used for this session (can be NULL)
* @param sender_address binary address of the sender (if observed)
* @param sender_address_len number of bytes in sender_address
- * @return how long the plugin should wait until receiving more data
+ * @return how long in ms the plugin should wait until receiving more data
* (plugins that do not support this, can ignore the return value)
*/
static struct GNUNET_TIME_Relative
plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- uint32_t distance,
- struct Session *session,
- const char *sender_address,
+ const struct GNUNET_TRANSPORT_ATS_Information *ats,
+ uint32_t ats_count,
+ struct Session *session,
+ const char *sender_address,
uint16_t sender_address_len)
{
struct TransportPlugin *plugin = cls;
struct GNUNET_TIME_Relative ret;
if (is_blacklisted (peer, plugin))
return GNUNET_TIME_UNIT_FOREVER_REL;
+ uint32_t distance;
+ int c;
n = find_neighbour (peer);
if (n == NULL)
service_context = service_context->next;
GNUNET_assert ((plugin->api->send == NULL) || (service_context != NULL));
peer_address = NULL;
+ distance = 1;
+ for (c=0; c<ats_count; c++)
+ {
+ if (ntohl(ats[c].type) == GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE)
+ {
+ distance = ntohl(ats[c].value);
+ }
+ }
+
if (message != NULL)
{
if ( (session != NULL) ||
(sender_address != NULL) )
- peer_address = add_peer_address (n,
+ peer_address = add_peer_address (n,
plugin->short_name,
session,
- sender_address,
- sender_address_len);
+ sender_address,
+ sender_address_len);
if (peer_address != NULL)
{
peer_address->distance = distance;
schedule_next_ping (peer_address);
}
/* update traffic received amount ... */
- msize = ntohs (message->size);
+ msize = ntohs (message->size);
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes received from other peers"),
msize,
n->peer_timeout =
GNUNET_TIME_relative_to_absolute
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
- GNUNET_SCHEDULER_cancel (sched,
- n->timeout_task);
+ GNUNET_SCHEDULER_cancel (n->timeout_task);
n->timeout_task =
- GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
&neighbour_timeout_task, n);
if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING |
GNUNET_ERROR_TYPE_BULK,
_
- ("Dropping incoming message due to repeated bandwidth quota (%u b/s) violations (total of %u).\n"),
+ ("Dropping incoming message due to repeated bandwidth quota (%u b/s) violations (total of %u).\n"),
n->in_tracker.available_bytes_per_s__,
n->quota_violation_count);
GNUNET_STATISTICS_update (stats,
#if DEBUG_PING_PONG
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),
+ ntohs (message->type),
+ ntohs (message->size),
GNUNET_i2s (peer));
#endif
switch (ntohs (message->type))
handle_payload_message (message, n);
break;
}
- }
+ }
ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0);
- if (ret.value > 0)
+ if (ret.rel_value > 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Throttling read (%llu bytes excess at %u b/s), waiting %llums before reading more.\n",
(unsigned long long) n->in_tracker.consumption_since_last_update__,
(unsigned int) n->in_tracker.available_bytes_per_s__,
- (unsigned long long) ret.value);
+ (unsigned long long) ret.rel_value);
GNUNET_STATISTICS_update (stats,
gettext_noop ("# ms throttling suggested"),
- (int64_t) ret.value,
- GNUNET_NO);
+ (int64_t) ret.rel_value,
+ GNUNET_NO);
}
return ret;
}
{
const struct StartMessage *start;
struct TransportClient *c;
- struct ConnectInfoMessage cim;
+ struct ConnectInfoMessage * cim;
struct NeighbourList *n;
+ uint32_t ats_count;
+ size_t size;
start = (const struct StartMessage*) message;
#if DEBUG_TRANSPORT
_("Rejecting control connection from peer `%s', which is not me!\n"),
GNUNET_i2s (&start->self));
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
- return;
+ return;
}
c = GNUNET_malloc (sizeof (struct TransportClient));
c->next = clients;
clients = c;
c->client = client;
if (our_hello != NULL)
- {
+ {
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending our own `%s' to new client\n", "HELLO");
(const struct GNUNET_MessageHeader *) our_hello,
GNUNET_NO);
/* tell new client about all existing connections */
- cim.header.size = htons (sizeof (struct ConnectInfoMessage));
- cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
- n = neighbours;
+ ats_count = 2;
+ size = sizeof (struct ConnectInfoMessage) + ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information);
+ if (size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ {
+ GNUNET_break(0);
+ }
+ cim = GNUNET_malloc (size);
+
+ cim->header.size = htons (size);
+ cim->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
+ cim->ats_count = htonl(ats_count);
+ (&(cim->ats))[2].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ (&(cim->ats))[2].value = htonl (0);
+ n = neighbours;
while (n != NULL)
- {
- if (GNUNET_YES == n->received_pong)
- {
- cim.id = n->id;
- cim.latency = GNUNET_TIME_relative_hton (n->latency);
- cim.distance = htonl (n->distance);
- transmit_to_client (c, &cim.header, GNUNET_NO);
- }
+ {
+ if (GNUNET_YES == n->received_pong)
+ {
+ (&(cim->ats))[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ (&(cim->ats))[0].value = htonl (n->distance);
+ (&(cim->ats))[1].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
+ (&(cim->ats))[1].value = htonl ((uint32_t) n->latency.rel_value);
+ cim->id = n->id;
+ transmit_to_client (c, &cim->header, GNUNET_NO);
+ }
n = n->next;
- }
- }
+ }
+ }
GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ GNUNET_free(cim);
}
GNUNET_STATISTICS_update (stats,
gettext_noop ("# HELLOs received from clients"),
1,
- GNUNET_NO);
+ GNUNET_NO);
ret = process_hello (NULL, message);
GNUNET_SERVER_receive_done (client, ret);
}
* Closure for 'transmit_client_message'; followed by
* 'msize' bytes of the actual message.
*/
-struct TransmitClientMessageContext
+struct TransmitClientMessageContext
{
/**
* Client on whom's behalf we are sending.
* Timeout for the transmission.
*/
struct GNUNET_TIME_Absolute timeout;
-
+
/**
* Message priority.
*/
/**
* Size of the message in bytes.
- */
+ */
uint16_t msize;
};
if (n != NULL)
{
- transmit_to_peer (tc, NULL, tcmc->priority,
+ transmit_to_peer (tc, NULL, tcmc->priority,
GNUNET_TIME_absolute_get_remaining (tcmc->timeout),
(char *)&tcmc[1],
tcmc->msize, GNUNET_NO, n);
GNUNET_STATISTICS_update (stats,
gettext_noop ("# payload received for other peers"),
size,
- GNUNET_NO);
+ GNUNET_NO);
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.
*
const struct QuotaSetMessage *qsm =
(const struct QuotaSetMessage *) message;
struct NeighbourList *n;
-
+
GNUNET_STATISTICS_update (stats,
gettext_noop ("# SET QUOTA messages received"),
1,
- GNUNET_NO);
+ GNUNET_NO);
n = find_neighbour (&qsm->peer);
if (n == NULL)
{
GNUNET_STATISTICS_update (stats,
gettext_noop ("# SET QUOTA messages ignored (no such peer)"),
1,
- GNUNET_NO);
+ GNUNET_NO);
return;
}
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' request (new quota %u, old quota %u) from client for peer `%4s'\n",
- "SET_QUOTA",
+ "SET_QUOTA",
(unsigned int) ntohl (qsm->quota.value__),
(unsigned int) n->in_tracker.available_bytes_per_s__,
GNUNET_i2s (&qsm->peer));
#endif
GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker,
qsm->quota);
- if (0 == ntohl (qsm->quota.value__))
+ if (0 == ntohl (qsm->quota.value__))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Disconnecting peer `%4s', %s\n", GNUNET_i2s(&n->id),
/**
* Take the given address and append it to the set of results sent back to
* the client.
- *
+ *
* @param cls the transmission context used ('struct GNUNET_SERVER_TransmitContext*')
* @param address the resolved name, NULL to indicate the last response
*/
tc = GNUNET_SERVER_transmit_context_create (client);
lsPlugin->api->address_pretty_printer (lsPlugin->api->cls,
nameTransport,
- address, addressLen,
+ address, addressLen,
numeric,
rtimeout,
&transmit_address_to_client, tc);
create_environment (struct TransportPlugin *plug)
{
plug->env.cfg = cfg;
- plug->env.sched = sched;
plug->env.my_identity = &my_identity;
plug->env.our_hello = &our_hello;
plug->env.cls = plug;
* Start the specified transport (load the plugin).
*/
static void
-start_transport (struct GNUNET_SERVER_Handle *server,
+start_transport (struct GNUNET_SERVER_Handle *server,
const char *name)
{
struct TransportPlugin *plug;
if (bc->th != NULL)
{
GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th);
- bc->th = NULL;
+ bc->th = NULL;
}
if (bc->task == GNUNET_SCHEDULER_NO_TASK)
- bc->task = GNUNET_SCHEDULER_add_now (sched,
- &do_blacklist_check,
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
bc);
break;
}
plugins = plug->next;
if (plug->address_update_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (plug->env.sched,
- plug->address_update_task);
+ GNUNET_SCHEDULER_cancel (plug->address_update_task);
plug->address_update_task = GNUNET_SCHEDULER_NO_TASK;
}
GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
* Initiate transport service.
*
* @param cls closure
- * @param s scheduler to use
* @param server the initialized server
* @param c configuration to use
*/
static void
run (void *cls,
- struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *c)
{
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,
unsigned long long tneigh;
char *keyfile;
- sched = s;
cfg = c;
- stats = GNUNET_STATISTICS_create (sched, "transport", cfg);
+ stats = GNUNET_STATISTICS_create ("transport", cfg);
validation_map = GNUNET_CONTAINER_multihashmap_create (64);
/* parse configuration */
if ((GNUNET_OK !=
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_
("Transport service is lacking key configuration settings. Exiting.\n"));
- GNUNET_SCHEDULER_shutdown (s);
+ GNUNET_SCHEDULER_shutdown ();
if (stats != NULL)
{
GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
return;
}
max_connect_per_transport = (uint32_t) tneigh;
- peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
+ peerinfo = GNUNET_PEERINFO_connect (cfg);
if (peerinfo == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Could not access PEERINFO service. Exiting.\n"));
- GNUNET_SCHEDULER_shutdown (s);
+ _("Could not access PEERINFO service. Exiting.\n"));
+ GNUNET_SCHEDULER_shutdown ();
if (stats != NULL)
{
GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_
("Transport service could not access hostkey. Exiting.\n"));
- GNUNET_SCHEDULER_shutdown (s);
+ GNUNET_SCHEDULER_shutdown ();
if (stats != NULL)
{
GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
}
GNUNET_free (plugs);
}
- GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
if (no_transports)
refresh_hello ();