GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending\n");
GNUNET_SERVER_notification_context_unicast (nc, c->handle,
(struct GNUNET_MessageHeader
- *) cbuf, GNUNET_YES);
+ *) cbuf, GNUNET_NO);
}
}
return count;
copy->tid = htonl (t->local_tid);
GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO);
GNUNET_SERVER_notification_context_unicast (nc, t->owner->handle,
- ©->header, GNUNET_YES);
+ ©->header, GNUNET_NO);
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
types = GNUNET_CONTAINER_multihashmap_create (32);
GNUNET_SERVER_add_handlers (server_handle, client_handlers);
- nc = GNUNET_SERVER_notification_context_create (server_handle,
- LOCAL_QUEUE_SIZE);
+ nc = GNUNET_SERVER_notification_context_create (server_handle, 1);
GNUNET_SERVER_disconnect_notify (server_handle,
&handle_local_client_disconnect, NULL);
#define GNUNET_MESH_LOCAL_TUNNEL_ID_CLI 0x80000000
#define GNUNET_MESH_LOCAL_TUNNEL_ID_SERV 0xB0000000
-#define CORE_QUEUE_SIZE 1
-#define LOCAL_QUEUE_SIZE 100
-
/******************************************************************************/
/************************** MESSAGES ******************************/
/******************************************************************************/
struct GNUNET_MESH_Tunnel *tunnel);
+/**
+ * Send an ack on the tunnel to confirm the processing of a message.
+ *
+ * @param h Mesh handle.
+ * @param t Tunnel on which to send the ACK.
+ */
+static void
+send_ack (struct GNUNET_MESH_Handle *h, struct GNUNET_MESH_Tunnel *t)
+{
+ struct GNUNET_MESH_LocalAck msg;
+
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK);
+ msg.header.size = htons (sizeof (msg));
+ msg.tunnel_id = htonl (t->tid);
+ msg.max_pid = t->pid + 1;
+
+ send_packet (h, &msg.header, t);
+ return;
+}
+
+
+
/**
* Reconnect callback: tries to reconnect again after a failer previous
* reconnecttion
LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
LOG (GNUNET_ERROR_TYPE_DEBUG, "******* RECONNECT *******\n");
LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "******** on %p *******\n", h);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
- h->in_receive = GNUNET_NO;
/* disconnect */
if (NULL != h->th)
{
reconnect (struct GNUNET_MESH_Handle *h)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Requested RECONNECT\n");
+ h->in_receive = GNUNET_NO;
if (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task)
h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time,
&reconnect_cbk, h);
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"callback completed successfully\n");
+ send_ack (h, t);
}
}
}
ntohs (msg->type));
}
LOG (GNUNET_ERROR_TYPE_DEBUG, "message processed\n");
- GNUNET_CLIENT_receive (h->client, &msg_received, h,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ if (GNUNET_YES == h->in_receive)
+ {
+ GNUNET_CLIENT_receive (h->client, &msg_received, h,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ }
+ else
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "in receive off, not calling CLIENT_receive\n");
+ }
}