*/
/**
- * @file fs/gnunet-service-fs_mesh.c
+ * @file fs/gnunet-service-fs_mesh_server.c
* @brief non-anonymous file-transfer
* @author Christian Grothoff
*
{
/**
* DLL
- */
+ */
struct MeshClient *next;
/**
* DLL
- */
+ */
struct MeshClient *prev;
/**
* Tunnel for communication.
- */
+ */
struct GNUNET_MESH_Tunnel *tunnel;
/**
* Handle for active write operation, or NULL.
- */
+ */
struct GNUNET_MESH_TransmitHandle *wh;
/**
* Tail of write queue.
*/
struct WriteQueueItem *wqi_tail;
-
+
/**
* Current active request to the datastore, if we have one pending.
*/
/**
* Size of the last write that was initiated.
- */
+ */
size_t reply_size;
};
/**
* Head of DLL of mesh clients.
- */
+ */
static struct MeshClient *sc_head;
/**
* Tail of DLL of mesh clients.
- */
+ */
static struct MeshClient *sc_tail;
/**
*
* @param cls the 'struct MeshClient'
* @param tc scheduler context
- */
+ */
static void
timeout_mesh_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
sc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
tun = sc->tunnel;
sc->tunnel = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Timeout for inactive mesh client %p\n",
+ sc);
GNUNET_MESH_tunnel_destroy (tun);
}
refresh_timeout_task (struct MeshClient *sc)
{
if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
- GNUNET_SCHEDULER_cancel (sc->timeout_task);
+ GNUNET_SCHEDULER_cancel (sc->timeout_task);
sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT,
&timeout_mesh_task,
sc);
continue_reading (struct MeshClient *sc)
{
refresh_timeout_task (sc);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Finished processing mesh request from client %p, ready to receive the next one\n",
+ sc);
GNUNET_MESH_receive_done (sc->tunnel);
}
sc->wqi_tail,
wqi);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitted %u byte reply via mesh\n",
- (unsigned int) size);
+ "Transmitted %u byte reply via mesh to %p\n",
+ (unsigned int) size,
+ sc);
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop ("# Blocks transferred via mesh"), 1,
GNUNET_NO);
}
sc->wh = GNUNET_MESH_notify_transmit_ready (sc->tunnel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
- wqi->msize,
+ wqi->msize,
&write_continuation,
sc);
if (NULL == sc->wh)
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
*/
-static void
+static void
handle_datastore_reply (void *cls,
const struct GNUNET_HashCode *key,
size_t size, const void *data,
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting transmission of %u byte reply for query `%s' via mesh\n",
+ "Starting transmission of %u byte reply for query `%s' via mesh to %p\n",
(unsigned int) size,
- GNUNET_h2s (key));
+ GNUNET_h2s (key),
+ sc);
wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize);
wqi->msize = msize;
srm = (struct MeshReplyMessage *) &wqi[1];
0,
&sqm->query,
ntohl (sqm->type),
- 0 /* priority */,
+ 0 /* priority */,
GSF_datastore_queue_size,
GNUNET_TIME_UNIT_FOREVER_REL,
&handle_datastore_reply, sc);
*
* @param cls NULL
* @param tunnel tunnel of the disconnecting client
- * @param tunnel_ctx our 'struct MeshClient'
+ * @param tunnel_ctx our 'struct MeshClient'
*/
static void
cleaner_cb (void *cls,
gettext_noop ("# mesh connections active"), -1,
GNUNET_NO);
if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task)
- GNUNET_SCHEDULER_cancel (sc->terminate_task);
+ GNUNET_SCHEDULER_cancel (sc->terminate_task);
if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
- GNUNET_SCHEDULER_cancel (sc->timeout_task);
+ GNUNET_SCHEDULER_cancel (sc->timeout_task);
if (NULL != sc->wh)
GNUNET_MESH_notify_transmit_ready_cancel (sc->wh);
if (NULL != sc->qe)
"MAX_MESH_CLIENTS",
&sc_count_max))
return;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Initializing mesh FS server with a limit of %llu connections\n",
+ sc_count_max);
listen_tunnel = GNUNET_MESH_connect (GSF_cfg,
NULL,
&accept_cb,