summaryrefslogtreecommitdiffstats
path: root/src/task.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-14 16:59:54 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-14 16:59:54 +0200
commitb9054051b9bf232968dc52b4732a65381c6a0e5f (patch)
tree9c9eaf61dbde5a48f09e097ab8ee4ecad37e06e0 /src/task.c
parent74f2d0357f87a231e3782d3d8bd21853fb3524b2 (diff)
downloadfastd-b9054051b9bf232968dc52b4732a65381c6a0e5f.tar
fastd-b9054051b9bf232968dc52b4732a65381c6a0e5f.zip
Reduce task queue usage
Diffstat (limited to 'src/task.c')
-rw-r--r--src/task.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/task.c b/src/task.c
index fb75766..3483853 100644
--- a/src/task.c
+++ b/src/task.c
@@ -31,35 +31,6 @@ fastd_task* fastd_task_get(fastd_context *ctx) {
return container_of(fastd_queue_get(ctx, &ctx->task_queue), fastd_task, entry);
}
-static void fastd_task_put_send_type(fastd_context *ctx, fastd_peer *peer, uint8_t packet_type, fastd_buffer buffer) {
- fastd_task *task = malloc(sizeof(fastd_task));
-
- task->type = TASK_SEND;
- task->peer = peer;
- task->send.packet_type = packet_type;
- task->send.buffer = buffer;
-
- fastd_queue_put(ctx, &ctx->task_queue, &task->entry, 0);
-}
-
-void fastd_task_put_send_handshake(fastd_context *ctx, fastd_peer *peer, fastd_buffer buffer) {
- fastd_task_put_send_type(ctx, peer, PACKET_HANDSHAKE, buffer);
-}
-
-void fastd_task_put_send(fastd_context *ctx, fastd_peer *peer, fastd_buffer buffer) {
- fastd_task_put_send_type(ctx, peer, PACKET_DATA, buffer);
-}
-
-void fastd_task_put_handle_recv(fastd_context *ctx, fastd_peer *peer, fastd_buffer buffer) {
- fastd_task *task = malloc(sizeof(fastd_task));
-
- task->type = TASK_HANDLE_RECV;
- task->peer = peer;
- task->handle_recv.buffer = buffer;
-
- fastd_queue_put(ctx, &ctx->task_queue, &task->entry, 0);
-}
-
static bool is_handshake(fastd_queue_entry *data, void *extra) {
fastd_task *task = container_of(data, fastd_task, entry);
fastd_peer *peer = extra;
@@ -153,22 +124,6 @@ static bool delete_task(fastd_queue_entry *data, void *extra) {
if (e->keepalive_only && task->type != TASK_KEEPALIVE)
return true;
- switch (task->type) {
- case TASK_SEND:
- fastd_buffer_free(task->send.buffer);
- break;
-
- case TASK_HANDLE_RECV:
- fastd_buffer_free(task->handle_recv.buffer);
- break;
-
- case TASK_HANDSHAKE:
- break;
-
- case TASK_KEEPALIVE:
- break;
- }
-
free(task);
return false;