[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] suspend/resume patch
From: |
Flavio Ceolin |
Subject: |
[libmicrohttpd] suspend/resume patch |
Date: |
Thu, 14 Apr 2016 14:38:54 -0300 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Hi folks,
Is there any reason for microhttpd do not check if a connections is
already resumed or suspended and handle this, instead of have undefined
behavior ? As far as I could see, the connection struct already has the
suspended field, so it's just a simple check.
For the user perspective is quite annoying and prone to error have to
maintain the connection status in its side. Bellow the patch, any
suggestion/explanation is welcome.
Index: src/include/microhttpd.h
===================================================================
--- src/include/microhttpd.h (revision 37040)
+++ src/include/microhttpd.h (working copy)
@@ -1957,10 +1957,7 @@
/**
* Resume handling of network data for suspended connection. It is
- * safe to resume a suspended connection at any time. Calling this
- * function on a connection that was not previously suspended will
- * result in undefined behavior.
- *
+ * safe to resume a suspended connection at any time.
* @param connection the connection to resume
*/
_MHD_EXTERN void
Index: src/microhttpd/daemon.c
===================================================================
--- src/microhttpd/daemon.c (revision 37040)
+++ src/microhttpd/daemon.c (working copy)
@@ -1714,6 +1714,8 @@
{
struct MHD_Daemon *daemon;
+ if (connection->suspended)
+ return;
daemon = connection->daemon;
if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME))
MHD_PANIC ("Cannot suspend connections without enabling
MHD_USE_SUSPEND_RESUME!\n");
@@ -1781,6 +1783,9 @@
{
struct MHD_Daemon *daemon;
+ if (!connection->suspended)
+ return;
+
daemon = connection->daemon;
if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME))
MHD_PANIC ("Cannot resume connections without enabling
MHD_USE_SUSPEND_RESUME!\n");
--
Flavio Ceolin
Intel Open source Technology Center
- [libmicrohttpd] suspend/resume patch,
Flavio Ceolin <=
- Re: [libmicrohttpd] suspend/resume patch, Christian Grothoff, 2016/04/14
- Re: [libmicrohttpd] suspend/resume patch, Flavio Ceolin, 2016/04/14
- Re: [libmicrohttpd] suspend/resume patch, Flavio Ceolin, 2016/04/20
- Re: [libmicrohttpd] suspend/resume patch, Evgeny Grin, 2016/04/20
- Re: [libmicrohttpd] suspend/resume patch, Kenneth Mastro, 2016/04/20
- Re: [libmicrohttpd] suspend/resume patch, Evgeny Grin, 2016/04/20
- Re: [libmicrohttpd] suspend/resume patch, Flavio Ceolin, 2016/04/20