#define DEBUG_ATS GNUNET_EXTRA_LOGGING
+#define INTERFACE_PROCESSING_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
+
/**
* Message in linked list we should send to the ATS service. The
* actual binary message follows this struct.
net->netmask = (struct sockaddr *) &tmp[1];
net->length = addrlen;
+ memset (&network4, 0, sizeof (network4));
network4.sin_family = AF_INET;
- network4.sin_port = htons (0);
#if HAVE_SOCKADDR_IN_SIN_LEN
network4.sin_len = sizeof (network4);
#endif
net->netmask = (struct sockaddr *) &tmp[1];
net->length = addrlen;
+ memset (&network6, 0, sizeof (network6));
network6.sin6_family = AF_INET6;
- network6.sin6_port = htons (0);
#if HAVE_SOCKADDR_IN_SIN_LEN
network6.sin6_len = sizeof (network6);
#endif
/* Store in list */
if (net != NULL)
{
+#if VERBOSE_ATS
char * netmask = strdup (GNUNET_a2s((struct sockaddr *) net->netmask, addrlen));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding network `%s', netmask `%s'\n",
GNUNET_a2s((struct sockaddr *) net->network, addrlen),
netmask);
GNUNET_free (netmask);
+# endif
GNUNET_CONTAINER_DLL_insert(sh->net_head, sh->net_tail, net);
}
return GNUNET_OK;
sh->interface_task = GNUNET_SCHEDULER_NO_TASK;
delete_networks (sh);
GNUNET_OS_network_interfaces_list(interface_proc, sh);
-
- sh->interface_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, get_addresses, sh);
+ sh->interface_task = GNUNET_SCHEDULER_add_delayed (INTERFACE_PROCESSING_INTERVALL,
+ get_addresses,
+ sh);
}
/**
struct GNUNET_ATS_Information
GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const struct sockaddr * addr, socklen_t addrlen)
{
+ GNUNET_assert (sh != NULL);
struct GNUNET_ATS_Information ats;
struct ATS_Network * cur = sh->net_head;
int type = GNUNET_ATS_NET_UNSPECIFIED;
type = GNUNET_ATS_NET_WAN;
#if VERBOSE
- char * range;
+ const char * range;
switch (type) {
case GNUNET_ATS_NET_WAN:
range = "WAN";
sh->suggest_cb_cls = suggest_cb_cls;
GNUNET_array_grow (sh->session_array, sh->session_array_size, 4);
GNUNET_OS_network_interfaces_list(interface_proc, sh);
- sh->interface_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, get_addresses, sh);
+ sh->interface_task = GNUNET_SCHEDULER_add_delayed (INTERFACE_PROCESSING_INTERVALL,
+ get_addresses,
+ sh);
reconnect (sh);
return sh;
}
GNUNET_SCHEDULER_cancel(sh->interface_task);
sh->interface_task = GNUNET_SCHEDULER_NO_TASK;
}
-
GNUNET_array_grow (sh->session_array, sh->session_array_size, 0);
GNUNET_free (sh);
+ sh = NULL;
}
size_t namelen;
size_t msize;
+ if ((address == NULL) && (session == NULL))
+ {
+ GNUNET_break (0);
+ return;
+ }
+
namelen =
(address->transport_name ==
NULL) ? 0 : strlen (address->transport_name) + 1;