gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated: chunked_example.c: a


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: chunked_example.c: added pseudo code to complete picture
Date: Tue, 25 Jul 2017 11:51:34 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 09ccb6f7 chunked_example.c: added pseudo code to complete picture
09ccb6f7 is described below

commit 09ccb6f7da257cfd6217c9254f90bf759187348e
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Tue Jul 25 12:49:25 2017 +0300

    chunked_example.c: added pseudo code to complete picture
---
 src/examples/chunked_example.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c
index cec20910..3cd008df 100644
--- a/src/examples/chunked_example.c
+++ b/src/examples/chunked_example.c
@@ -20,6 +20,7 @@
  * @file chunked_example.c
  * @brief example for generating chunked encoding with libmicrohttpd
  * @author Christian Grothoff
+ * @author Karlson2k (Evgeny Grin)
  */
 
 #include "platform.h"
@@ -44,12 +45,31 @@ callback (void *cls,
       return MHD_CONTENT_READER_END_OF_STREAM;
     }
 
+  /* Pseudo code.        *
+  if (data_not_ready)
+    {
+      // Callback will be called again on next loop.
+      // Consider suspending connection until data will be ready.
+      return 0;
+    }
+   * End of pseudo code. */
+
   if (buf_size < (response_size - pos) )
     size_to_copy = buf_size;
   else
     size_to_copy = response_size - pos;
 
   memcpy (buf, response_data + pos, size_to_copy);
+
+  /* Pseudo code.        *
+  if (error_preparing_response)
+    {
+      // Close connection with error.
+      return MHD_CONTENT_READER_END_WITH_ERROR;
+    }
+   * End of pseudo code. */
+
+  /* Return amount of data copied to buffer. */
   return size_to_copy;
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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