/*
This file is part of GNUnet.
- Copyright (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009, 2010, 2011 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
/**
- * Map of peer identities to 'struct Neighbour'.
+ * Map of peer identities to `struct Neighbour`.
*/
static struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
size_t ret;
char *cbuf;
struct GNUNET_TIME_Relative delay;
+ struct GNUNET_TIME_Relative overdue;
n->th = NULL;
m = n->message_head;
return 0;
}
delay = GNUNET_TIME_absolute_get_duration (m->submission_time);
+ overdue = GNUNET_TIME_absolute_get_duration (m->deadline);
cbuf = buf;
GNUNET_assert (size >= m->size);
memcpy (cbuf,
&m[1],
m->size);
ret = m->size;
- if (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us)
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Copied message of type %u and size %u into transport buffer for `%s' with delay of %s\n",
- (unsigned int)
- ntohs (((struct GNUNET_MessageHeader *) &m[1])->type),
- (unsigned int) ret,
- GNUNET_i2s (&n->peer),
- GNUNET_STRINGS_relative_time_to_string (delay,
- GNUNET_YES));
+ if (overdue.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Copied overdue message of type %u and size %u into transport buffer for `%s' with delay of %s\n",
+ (unsigned int)
+ ntohs (((struct GNUNET_MessageHeader *) &m[1])->type),
+ (unsigned int) ret,
+ GNUNET_i2s (&n->peer),
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES));
else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Copied message of type %u and size %u into transport buffer for `%s' with delay of %s\n",
{
/* duplicate connect notification!? */
GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Peer %s exists already\n",
+ GNUNET_i2s (peer));
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
{
struct Neighbour *n;
+ if (0 == memcmp (peer,
+ &GSC_my_identity,
+ sizeof (struct GNUNET_PeerIdentity)))
+ {
+ GNUNET_break (0);
+ return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%s' disconnected from us; received notification from transport.\n",
GNUNET_i2s (peer));
if (NULL == n)
{
GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Peer %s not found\n",
+ GNUNET_i2s (peer));
return;
}
free_neighbour (n);
{
/* received message from peer that is not connected!? */
GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Peer %s not found\n",
+ GNUNET_i2s (peer));
return;
}
type = ntohs (message->type);
if (NULL == n)
{
GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Peer %s not found\n",
+ GNUNET_i2s (target));
return;
}
msize = ntohs (msg->size);
/**
- * One of our neighbours has excess bandwidth,
- * remember this.
+ * One of our neighbours has excess bandwidth, remember this.
*
* @param cls NULL
* @param pid identity of the peer with excess bandwidth
{
struct Neighbour *n;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Peer %s has excess bandwidth available\n",
- GNUNET_i2s (pid));
n = find_neighbour (pid);
if (NULL == n)
{
GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Peer %s not found\n",
+ GNUNET_i2s (pid));
return;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Peer %s has excess bandwidth available\n",
+ GNUNET_i2s (pid));
n->has_excess_bandwidth = GNUNET_YES;
GSC_SESSIONS_solicit (pid);
}
if (NULL == n)
{
GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Peer %s not found\n",
+ GNUNET_i2s (target));
return UINT_MAX;
}
return n->queue_size;
if (NULL == n)
{
GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Peer %s not found\n",
+ GNUNET_i2s (target));
return GNUNET_SYSERR;
}
return n->has_excess_bandwidth;