From: Andre Date: Wed, 31 May 2006 02:38:56 +0000 (+0200) Subject: fix dccp sender/receiver X-Git-Tag: v0.2.14~94 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=8cec3d1edb26b4861e2b5bdbb9f70241cdd7f03b;p=paraslash.git fix dccp sender/receiver the server side broke during the afs header cleanup, the client side had a fatal pointer bug and missed to set the return value in its pre_select function. --- diff --git a/dccp_recv.c b/dccp_recv.c index a9e30e8e..3be5365f 100644 --- a/dccp_recv.c +++ b/dccp_recv.c @@ -121,10 +121,12 @@ static void *dccp_recv_parse_config(int argc, char **argv) static void dccp_recv_pre_select(struct sched *s, struct task *t) { - struct private_dccp_recv_data *pdd = t->private_data; + struct receiver_node *rn = t->private_data; + struct private_dccp_recv_data *pdd = rn->private_data; + t->ret = 1; if (!pdd) - return ; + return; para_fd_set(pdd->fd, &s->rfds, &s->max_fileno); } diff --git a/dccp_send.c b/dccp_send.c index 546056a0..9bfe65f6 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -152,25 +152,25 @@ static void dccp_send(long unsigned current_chunk, continue; if (!dc->header_sent && current_chunk) { header_buf = afs_get_header(&header_len); - if (!header_buf || header_len <= 0) - continue; /* header not yet available */ - ret = dccp_write(dc->fd, header_buf, header_len); - if (ret != header_len) { - int err = errno; - PARA_ERROR_LOG("header write: %d/%d (%s)\n", - ret, header_len, ret < 0? - strerror(err) : ""); - dccp_shutdown_client(dc); - continue; + if (header_buf && header_len > 0) { + ret = dccp_write(dc->fd, header_buf, header_len); + if (ret != header_len) { + int err = errno; + PARA_ERROR_LOG("header write: %d/%d (%s)\n", + ret, header_len, ret < 0? + strerror(err) : ""); + dccp_shutdown_client(dc); + continue; + } + dc->header_sent = 1; + ret = write_ok(dc->fd); + if (ret < 0) { + dccp_shutdown_client(dc); + continue; + } + if (!ret) + continue; } - dc->header_sent = 1; - ret = write_ok(dc->fd); - if (ret < 0) { - dccp_shutdown_client(dc); - continue; - } - if (!ret) - continue; } // PARA_DEBUG_LOG("writing %d bytes to fd %d\n", len, dc->fd); ret = dccp_write(dc->fd, buf, len);