/*
- * Copyright (C) 2005-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2010 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
struct btr_node *btrn = rn->btrn;
int ret;
char *buf;
- size_t sz;
+ size_t sz, n;
t->error = 0;
ret = btr_node_status(btrn, 0, BTR_NT_ROOT);
phd->status = HTTP_SENT_GET_REQUEST;
return;
}
- if (!FD_ISSET(phd->fd, &s->rfds))
- return;
if (phd->status == HTTP_SENT_GET_REQUEST) {
- ret = recv_pattern(phd->fd, HTTP_OK_MSG, strlen(HTTP_OK_MSG));
+ ret = read_pattern(phd->fd, HTTP_OK_MSG, strlen(HTTP_OK_MSG), &s->rfds);
if (ret < 0)
goto err;
+ if (ret == 0)
+ return;
PARA_INFO_LOG("received ok msg, streaming\n");
phd->status = HTTP_STREAMING;
return;
sz = btr_pool_get_buffer(phd->btrp, &buf);
if (sz == 0)
goto err;
- ret = recv_bin_buffer(phd->fd, buf, sz);
- if (ret == 0)
- ret = -E_RECV_EOF;
- if (ret < 0)
- goto err;
- btr_add_output_pool(phd->btrp, ret, btrn);
- return;
+ ret = read_nonblock(phd->fd, buf, sz, &s->rfds, &n);
+ if (n > 0)
+ btr_add_output_pool(phd->btrp, n, btrn);
+ if (ret >= 0)
+ return;
err:
btr_remove_node(rn->btrn);
t->error = ret;
{
struct private_http_recv_data *phd;
struct http_recv_args_info *conf = rn->conf;
- int fd, ret = makesock(AF_UNSPEC, IPPROTO_TCP, 0, conf->host_arg,
- conf->port_arg);
+ int fd, ret = para_connect_simple(IPPROTO_TCP, conf->host_arg,
+ conf->port_arg);
if (ret < 0)
return ret;
static void http_recv_free_config(void *conf)
{
http_recv_cmdline_parser_free(conf);
+ free(conf);
}
/**