#define PONG_PRIORITY 4
+GNUNET_NETWORK_STRUCT_BEGIN
+
/**
* Message used to ask a peer to validate receipt (to check an address
* from a HELLO). Followed by the address we are trying to validate,
uint32_t addrlen GNUNET_PACKED;
};
-
+GNUNET_NETWORK_STRUCT_END
/**
* Information about an address under validation
* Are we expecting a PONG message for this validation entry?
*/
int expecting_pong;
+
+ /* FIXME: DEBUGGING */
+ int last_line_set_to_no;
+ int last_line_set_to_yes;
};
else
{
GNUNET_assert (papi->send != NULL);
- ret =
- papi->send (papi->cls, pid, message_buf, tsize, PING_PRIORITY,
- ACCEPTABLE_PING_DELAY, NULL /* no session */ ,
- ve->address->address, ve->address->address_length,
- GNUNET_YES, NULL, NULL);
+ GNUNET_assert (papi->get_session != NULL);
+ struct Session * session = papi->get_session(papi->cls, ve->address);
+
+ if (session != NULL)
+ {
+ ret = papi->send (papi->cls, session,
+ message_buf, tsize,
+ PING_PRIORITY, ACCEPTABLE_PING_DELAY,
+ NULL, NULL);
+ }
+ else
+ {
+ /* Could not get a valid session */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not get a valid session for `%s' %s\n",
+ GNUNET_i2s (pid), GST_plugins_a2s (ve->address));
+ ret = -1;
+ }
}
}
if (-1 != ret)
if (public_key == NULL)
return NULL;
ve = GNUNET_malloc (sizeof (struct ValidationEntry));
+ ve->in_use = GNUNET_SYSERR; /* not defined */
+ ve->last_line_set_to_no = 0;
+ ve->last_line_set_to_yes = 0;
ve->address = GNUNET_HELLO_address_copy (address);
ve->public_key = *public_key;
ve->pid = address->peer;
*
* @param cls the PONG message
* @param public_key public key for the peer, never NULL
- * @param target peer this change is about, never NULL
* @param valid_until is ZERO if we never validated the address,
* otherwise a time up to when we consider it (or was) valid
* @param validation_block is FOREVER if the address is for an unsupported plugin (from PEERINFO)
* is ZERO if the address is considered valid (no validation needed)
* otherwise a time in the future if we're currently denying re-validation
- * @param adress target address
+ * @param address target address
*/
static void
multicast_pong (void *cls,
papi = GST_plugins_find (address->transport_name);
if (papi == NULL)
return;
- (void) papi->send (papi->cls, &address->peer, (const char *) pong,
- ntohs (pong->header.size), PONG_PRIORITY,
- ACCEPTABLE_PING_DELAY, NULL, address->address,
- address->address_length, GNUNET_YES, NULL, NULL);
+
+ GNUNET_assert (papi->send != NULL);
+ GNUNET_assert (papi->get_session != NULL);
+
+ struct Session * session = papi->get_session(papi->cls, address);
+ if (session == NULL)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ papi->send (papi->cls, session,
+ (const char *) pong, ntohs (pong->header.size),
+ PONG_PRIORITY, ACCEPTABLE_PING_DELAY,
+ NULL, NULL);
}
}
pong->signature = *sig_cache;
+ GNUNET_assert (sender_address != NULL);
+
/* first see if the session we got this PING from can be used to transmit
* a response reliably */
papi = GST_plugins_find (sender_address->transport_name);
if (papi == NULL)
ret = -1;
else
- ret =
- papi->send (papi->cls, sender, (const char *) pong,
- ntohs (pong->header.size), PONG_PRIORITY,
- ACCEPTABLE_PING_DELAY, session, sender_address->address,
- sender_address->address_length, GNUNET_SYSERR, NULL, NULL);
+ {
+ GNUNET_assert (papi->send != NULL);
+ GNUNET_assert (papi->get_session != NULL);
+
+ if (session == NULL)
+ {
+ session = papi->get_session (papi->cls, sender_address);
+ }
+ if (session == NULL)
+ {
+ GNUNET_break (0);
+ ret = -1;
+ }
+ else
+ {
+ ret = papi->send (papi->cls, session,
+ (const char *) pong, ntohs (pong->header.size),
+ PONG_PRIORITY, ACCEPTABLE_PING_DELAY,
+ NULL, NULL);
+ }
+ }
if (ret != -1)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
* Based on this, the validation module will measure latency for the
* address more or less often.
*
- * @param sender peer FIXME: redundant!
* @param address the address
+ * @param session the session
* @param in_use GNUNET_YES if we are now using the address for a connection,
* GNUNET_NO if we are no longer using the address for a connection
+ * @param line line of caller just for DEBUGGING!
*/
void
-GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session, int in_use)
+GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address,
+ struct Session *session,
+ int in_use,
+ int line)
{
struct ValidationEntry *ve;
return;
}
if (ve->in_use == in_use)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "GST_validation_set_address_use: %s %s: ve->in_use %i <-> in_use %i\n",
- GNUNET_i2s (sender), GST_plugins_a2s (address), ve->in_use,
- in_use);
+ {
+
+ if (GNUNET_YES == in_use)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Error setting address in use for peer `%s' `%s' to USED: set last time by %i, called now by %i\n",
+ GNUNET_i2s (&address->peer), GST_plugins_a2s (address),
+ ve->last_line_set_to_yes, line);
+ }
+ if (GNUNET_NO == in_use)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Error setting address in use for peer `%s' `%s' to NOT_USED: set last time by %i, called now by %i\n",
+ GNUNET_i2s (&address->peer), GST_plugins_a2s (address),
+ ve->last_line_set_to_no, line);
+ }
+ }
+
+ if (GNUNET_YES == in_use)
+ {
+ ve->last_line_set_to_yes = line;
+ }
+ if (GNUNET_NO == in_use)
+ {
+ ve->last_line_set_to_no = line;
+ }
+
GNUNET_break (ve->in_use != in_use); /* should be different... */
ve->in_use = in_use;
if (in_use == GNUNET_YES)