]> git.tue.mpg.de Git - paraslash.git/commitdiff
fix dccp sender/receiver
authorAndre <maan@p133.(none)>
Wed, 31 May 2006 02:38:56 +0000 (04:38 +0200)
committerAndre <maan@p133.(none)>
Wed, 31 May 2006 02:38:56 +0000 (04:38 +0200)
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.

dccp_recv.c
dccp_send.c

index a9e30e8e5676006f4e35f96668c6dc831a7cab7c..3be5365fe818f4b14133a87c2d561df7b9feec59 100644 (file)
@@ -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);
 }
 
index 546056a04282b9b87c27b9a4cfb811fd005f761d..9bfe65f68a7bc7634c5ba581589e95c96c434e18 100644 (file)
@@ -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);