aft.c: Prefer localtime() over localtime_r().
[paraslash.git] / http_recv.c
index 7db8ba193c1eaa2fd6046efd91011c25d37da032..2f334787200e4a0134df6a108a0c4dc8a7dd0775 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005 Andre Noll <maan@tuebingen.mpg.de>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -7,7 +7,12 @@
 /** \file http_recv.c paraslash's http receiver */
 
 #include <regex.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
 #include <sys/types.h>
+#include <arpa/inet.h>
+#include <sys/un.h>
+#include <netdb.h>
 
 #include "para.h"
 #include "error.h"
@@ -55,12 +60,12 @@ static char *make_request_msg(void)
        return ret;
 }
 
-static void http_recv_pre_select(struct sched *s, struct task *t)
+static void http_recv_pre_select(struct sched *s, void *context)
 {
-       struct receiver_node *rn = container_of(t, struct receiver_node, task);
+       struct receiver_node *rn = context;
        struct private_http_recv_data *phd = rn->private_data;
 
-       if (generic_recv_pre_select(s, t) <= 0)
+       if (generic_recv_pre_select(s, rn) <= 0)
                return;
        if  (phd->status == HTTP_CONNECTED)
                para_fd_set(rn->fd, &s->wfds, &s->max_fileno);
@@ -73,16 +78,16 @@ static void http_recv_pre_select(struct sched *s, struct task *t)
  * area with data read from the socket. In any case, update the state of the
  * connection if necessary.
  */
-static int http_recv_post_select(struct sched *s, struct task *t)
+static int http_recv_post_select(struct sched *s, void *context)
 {
-       struct receiver_node *rn = container_of(t, struct receiver_node, task);
+       struct receiver_node *rn = context;
        struct private_http_recv_data *phd = rn->private_data;
        struct btr_node *btrn = rn->btrn;
        int ret, iovcnt;
        struct iovec iov[2];
        size_t num_bytes;
 
-       ret = task_get_notification(t);
+       ret = task_get_notification(rn->task);
        if (ret < 0)
                goto out;
        ret = btr_node_status(btrn, 0, BTR_NT_ROOT);