gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25366 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r25366 - gnunet/src/fs
Date: Mon, 10 Dec 2012 15:44:23 +0100

Author: grothoff
Date: 2012-12-10 15:44:23 +0100 (Mon, 10 Dec 2012)
New Revision: 25366

Modified:
   gnunet/src/fs/gnunet-service-fs_stream.c
Log:
-fixes

Modified: gnunet/src/fs/gnunet-service-fs_stream.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_stream.c    2012-12-10 14:42:40 UTC (rev 
25365)
+++ gnunet/src/fs/gnunet-service-fs_stream.c    2012-12-10 14:44:23 UTC (rev 
25366)
@@ -1049,6 +1049,15 @@
 
 
 /**
+ * Transmit the next entry from the write queue.
+ *
+ * @param sc where to process the write queue
+ */
+static void
+continue_writing (struct StreamClient *sc);
+
+
+/**
  * Functions of this signature are called whenever data is available from the
  * stream.
  *
@@ -1098,21 +1107,12 @@
     GNUNET_break (0);
     return size;
   }
-  continue_reading (sc);
+  continue_writing (sc);
   return size;
 }
 
 
 /**
- * Transmit the next entry from the write queue.
- *
- * @param sc where to process the write queue
- */
-static void
-continue_writing (struct StreamClient *sc);
-
-
-/**
  * Sending a reply was completed, continue processing.
  *
  * @param cls closure with the struct StreamClient which sent the query
@@ -1127,26 +1127,21 @@
   struct StreamClient *sc = cls;
   
   sc->wh = NULL;
-  if ( (GNUNET_STREAM_OK == status) &&
-       (size == sc->reply_size) )
+  if ( (GNUNET_STREAM_OK != status) ||
+       (size != sc->reply_size) )
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-               "Transmitted %u byte reply via stream\n",
-               (unsigned int) size);
-    GNUNET_STATISTICS_update (GSF_stats,
-                             gettext_noop ("# Blocks transferred via stream"), 
1,
-                             GNUNET_NO);
-    if (NULL != sc->wqi_head)
-      continue_writing (sc);
-    else
-      continue_reading (sc);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                "Transmission of reply failed, terminating stream\n");
     terminate_stream (sc);    
+    return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Transmitted %u byte reply via stream\n",
+             (unsigned int) size);
+  GNUNET_STATISTICS_update (GSF_stats,
+                           gettext_noop ("# Blocks transferred via stream"), 1,
+                           GNUNET_NO);
+  continue_writing (sc);
 }
 
 
@@ -1221,14 +1216,14 @@
                                          &handle_datastore_reply,
                                          sc))
     {
-      continue_reading (sc);
+      continue_writing (sc);
     }
     return;
   }
   if (msize > GNUNET_SERVER_MAX_MESSAGE_SIZE)
   {
     GNUNET_break (0);
-    continue_reading (sc);
+    continue_writing (sc);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1295,7 +1290,7 @@
                                       GNUNET_TIME_UNIT_FOREVER_REL,
                                       &handle_datastore_reply, sc);
     if (NULL == sc->qe)
-      continue_reading (sc);
+      continue_writing (sc);
     return GNUNET_OK;
   default:
     GNUNET_break_op (0);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]