smr->queue_size = htonl (pr->queue_size);
smr->size = htons (th->msize);
smr->smr_id = htons (th->smr_id = pr->smr_id_gen++);
- GNUNET_CONTAINER_DLL_insert_after (h->control_pending_head,
- h->control_pending_tail,
- h->control_pending_tail,
- cm);
+ GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head,
+ h->control_pending_tail,
+ cm);
#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding SEND REQUEST for peer `%s' to message queue\n",
ret = th->get_message (th->get_message_cls,
size - sizeof (struct SendMessage),
&sm[1]);
-
- if (0 == ret)
+
+#if DEBUG_CORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitting SEND request to `%s' yielded %u bytes.\n",
+ GNUNET_i2s (&pr->peer),
+ ret);
+#endif
+ if (0 == ret)
{
#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
return;
}
msize = ntohs (msg->size);
-#if DEBUG_CORE
+#if DEBUG_CORE > 2
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processing message of type %u and size %u from core service\n",
ntohs (msg->type), msize);
reconnect_later (h);
return;
}
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received notification about status change by `%s'.\n",
GNUNET_i2s (&psnm->peer));
}
#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received notification about configuration update for `%s'.\n",
- GNUNET_i2s (&cim->peer));
+ "Received notification about configuration update for `%s' with RIM %u.\n",
+ GNUNET_i2s (&cim->peer),
+ (unsigned int) ntohl (cim->rim_id));
#endif
pr = GNUNET_CONTAINER_multihashmap_get (h->peers,
&cim->peer.hashPubKey);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Queueing REQUEST_CONNECT request\n");
#endif
- if (h->control_pending_head == cm)
- trigger_next_request (h, GNUNET_NO);
+ trigger_next_request (h, GNUNET_NO);
return ret;
}
struct GNUNET_CORE_Handle *h = req->h;
struct ControlMessage *cm = req->cm;
+#if DEBUG_CORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "A CHANGE PREFERENCE request was cancelled!\n");
+#endif
GNUNET_CONTAINER_DLL_remove (h->control_pending_head,
h->control_pending_tail,
cm);
rim->peer = *peer;
#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Queueing CHANGE PREFERENCE request\n");
+ "Queueing CHANGE PREFERENCE request for peer `%s' with RIM %u\n",
+ GNUNET_i2s (peer),
+ (unsigned int) pr->rim_id);
#endif
GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head,
h->control_pending_tail,
pr->pcic = info;
pr->pcic_cls = info_cls;
pr->pcic_ptr = irc; /* for free'ing irc */
- if (h->control_pending_head == cm)
- trigger_next_request (h, GNUNET_NO);
+ trigger_next_request (h, GNUNET_NO);
return irc;
}
const struct GNUNET_MessageHeader *msg,
int can_drop)
{
-#if DEBUG_CORE_CLIENT
+#if DEBUG_CORE_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Preparing to send %u bytes of message of type %u to client.\n",
(unsigned int) ntohs (msg->size),
{
if (0 != (c->options & options))
{
-#if DEBUG_CORE_CLIENT
+#if DEBUG_CORE_CLIENT > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending message of type %u to client.\n",
(unsigned int) ntohs (msg->type));
if ( (! n->is_connected) ||
(n->status != PEER_STATE_KEY_CONFIRMED) )
return;
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%4s' changed status\n",
GNUNET_i2s (&n->peer));
#endif
cim.reserved_amount = htonl (got_reserv);
cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay);
- cim.rim_id = rcm->rim_id;
cim.bw_out = n->bw_out;
cim.preference = n->current_preference;
}
+ else
+ {
+ /* Technically, this COULD happen (due to asynchronous behavior),
+ but it is very odd, so we should at least generate a stern
+ warning */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Client asked for preference change with peer `%s', which is not connected!\n",
+ GNUNET_i2s (&rcm->peer));
+ }
cim.header.size = htons (sizeof (struct ConfigurationInfoMessage));
cim.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO);
cim.peer = rcm->peer;
+ cim.rim_id = rcm->rim_id;
#if DEBUG_CORE_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending `%s' message to client.\n", "CONFIGURATION_INFO");
&n->encrypt_key,
iv, out));
GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes encrypted"), size, GNUNET_NO);
-#if DEBUG_CORE
+#if DEBUG_CORE > 2
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Encrypted %u bytes for `%4s' using key %u, IV %u\n",
(unsigned int) size,
process_plaintext_neighbour_queue (n);
return;
}
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking transport for transmission of %u bytes to `%4s' in next %llu ms\n",
(unsigned int) m->size,
gettext_noop ("# bytes decrypted"),
size,
GNUNET_NO);
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Decrypted %u bytes from `%4s' using key %u, IV %u\n",
(unsigned int) size,
pos->do_transmit = GNUNET_YES; /* mark for transmission */
off += pos->size;
size -= pos->size;
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Selecting message of size %u for transmission\n",
(unsigned int) pos->size);
}
else
{
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Not selecting message of size %u for transmission at this time (maximum is %u)\n",
(unsigned int) pos->size,
ret += pos->size;
size -= pos->size;
*priority += pos->priority;
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding plaintext message of size %u with deadline %llu ms to batch\n",
(unsigned int) pos->size,
}
pos = next;
}
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Deadline for message batch is %llu ms\n",
GNUNET_TIME_absolute_get_remaining (*deadline).rel_value);
}
if (n->encrypted_head != NULL)
{
-#if DEBUG_CORE
+#if DEBUG_CORE > 2
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Encrypted message queue for `%4s' is still full, delaying plaintext processing.\n",
GNUNET_i2s(&n->peer));
&deadline, &retry_time, &priority);
if (used == sizeof (struct EncryptedMessage))
{
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"No messages selected for transmission to `%4s' at this time, will try again later.\n",
GNUNET_i2s(&n->peer));
&retry_plaintext_processing, n);
return;
}
-#if DEBUG_CORE_QUOTA
+#if DEBUG_CORE_QUOTA
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending %u b/s as new limit to peer `%4s'\n",
(unsigned int) ntohl (n->bw_in.value__),
em->iv_seed = ph->iv_seed;
derive_iv (&iv, &n->encrypt_key, ph->iv_seed, &n->peer);
/* encrypt */
-#if DEBUG_HANDSHAKE
+#if DEBUG_HANDSHAKE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Encrypting %u bytes of plaintext messages for `%4s' for transmission in %llums.\n",
(unsigned int) used - ENCRYPTED_HEADER_SIZE,
if (0 != memcmp (&t.target,
&my_identity, sizeof (struct GNUNET_PeerIdentity)))
{
- char * sender;
- GNUNET_asprintf(&sender, "%s",GNUNET_i2s (&n->peer));
- char * peer;
- GNUNET_asprintf(&peer, "%s",GNUNET_i2s (&t.target));
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Received PING from `%s' for different identity: I am `%s', PONG identity: `%s'\n",sender, GNUNET_i2s (&my_identity), peer );
- GNUNET_free (sender);
- GNUNET_free (peer);
+ char sender[9];
+ char peer[9];
+
+ GNUNET_snprintf(sender, sizeof (sender), "%8s", GNUNET_i2s (&n->peer));
+ GNUNET_snprintf(peer, sizeof (peer), "%8s", GNUNET_i2s (&t.target));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Received PING from `%s' for different identity: I am `%s', PONG identity: `%s'\n"),
+ sender,
+ GNUNET_i2s (&my_identity),
+ peer);
GNUNET_break_op (0);
return;
}
struct GNUNET_TRANSPORT_ATS_Information *mats;
size_t size;
-#if DEBUG_CORE
+#if DEBUG_HANDSHAKE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core service receives `%s' response from `%4s'.\n",
"PONG", GNUNET_i2s (&n->peer));
int dropped;
type = ntohs (m->type);
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received encapsulated message of type %u and size %u from `%4s'\n",
(unsigned int) type,
uint16_t size;
int changed;
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received message of type %u from `%4s', demultiplexing.\n",
(unsigned int) ntohs (message->type),
if ((n->status != PEER_STATE_KEY_RECEIVED) &&
(n->status != PEER_STATE_KEY_CONFIRMED))
{
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n",
"PING", GNUNET_i2s (&n->peer));
if ( (n->status != PEER_STATE_KEY_RECEIVED) &&
(n->status != PEER_STATE_KEY_CONFIRMED) )
{
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n",
"PONG", GNUNET_i2s (&n->peer));
uint64_t need_per_second;
unsigned int neighbour_count;
-#if DEBUG_CORE
+#if DEBUG_CORE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Neighbour quota update calculation running for peer `%4s'\n",
GNUNET_i2s (&n->peer));