user_list.c: Minor documentation impreovements.
[paraslash.git] / vss.c
diff --git a/vss.c b/vss.c
index efd0c5ea8e43402fc85f801fc87f039674cf91a8..d74cec3ccf7f8feffbf92382ccfc26ac491d50c1 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C) 1997-2007 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-2008 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -25,6 +25,7 @@
 #include "net.h"
 #include "server.cmdline.h"
 #include "vss.h"
 #include "net.h"
 #include "server.cmdline.h"
 #include "vss.h"
+#include "list.h"
 #include "send.h"
 #include "ipc.h"
 #include "fd.h"
 #include "send.h"
 #include "ipc.h"
 #include "fd.h"
@@ -261,9 +262,13 @@ struct timeval *vss_chunk_time(void)
        return &mmd->afd.afhi.chunk_tv;
 }
 
        return &mmd->afd.afhi.chunk_tv;
 }
 
+/** The possible states of the afs socket. See \ref afs_socket. */
 enum afs_socket_status {
 enum afs_socket_status {
+       /** Socket is inactive. */
        AFS_SOCKET_READY,
        AFS_SOCKET_READY,
+       /** Socket fd was included in the write fd set for select(). */
        AFS_SOCKET_CHECK_FOR_WRITE,
        AFS_SOCKET_CHECK_FOR_WRITE,
+       /** vss wrote a request to the socket and waits for afs to reply. */
        AFS_SOCKET_AFD_PENDING
 };
 
        AFS_SOCKET_AFD_PENDING
 };
 
@@ -379,6 +384,7 @@ static void recv_afs_result(void)
        struct stat statbuf;
        struct timeval now;
 
        struct stat statbuf;
        struct timeval now;
 
+       mmd->afd.afhi.chunk_table = NULL;
        ret = recv_afs_msg(&passed_fd, &afs_code, &afs_data);
        if (ret < 0)
                goto err;
        ret = recv_afs_msg(&passed_fd, &afs_code, &afs_data);
        if (ret < 0)
                goto err;
@@ -415,9 +421,10 @@ static void recv_afs_result(void)
        tv_add(&now, &announce_tv, &data_send_barrier);
        return;
 err:
        tv_add(&now, &announce_tv, &data_send_barrier);
        return;
 err:
+       free(mmd->afd.afhi.chunk_table);
        if (passed_fd >= 0)
                close(passed_fd);
        if (passed_fd >= 0)
                close(passed_fd);
-       PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
+       PARA_ERROR_LOG("%s\n", para_strerror(-ret));
        mmd->new_vss_status_flags = VSS_NEXT;
 }
 
        mmd->new_vss_status_flags = VSS_NEXT;
 }
 
@@ -494,8 +501,8 @@ void vss_send_chunk(void)
        }
        /*
         * We call the send function also in case of empty chunks as they
        }
        /*
         * We call the send function also in case of empty chunks as they
-        * might have still some data queued which can be sent in this case.
-        */
+        * might have still some data queued which can be sent in this case.
+        */
        if (!mmd->chunks_sent) {
                struct timeval tmp;
                gettimeofday(&mmd->stream_start, NULL);
        if (!mmd->chunks_sent) {
                struct timeval tmp;
                gettimeofday(&mmd->stream_start, NULL);