Awesome project, I'll study it. Thanks for sharing! :-) On Thu, Mar 16, 2017 at 10:57 AM, Vitaliy T <vitaliy.toka...@gmail.com> wrote:
> Hi, > > On 16 March 2017 at 00:29, Vitaliy T <vitaliy.toka...@gmail.com> wrote: > > On 15 March 2017 at 23:54, Evgeny Grin <k...@yandex.ru> wrote: > >> That's why I asked about user code example. I can't test what we trying > >> to fix. > > > > I understand you wish clearly. I will provide the code tomorrow. > > Sources: https://github.com/gh0stwizard/x11mirror-server > > Build: > > # define the location where MHD installed > export PKG_CONFIG_PATH=/path/to/lib/pkgconfig > export LD_LIBRARY_PATH=/path/to/lib > make > > Server usage: > > $ ./x11mirror-server -? > > ./x11mirror-server: unrecognized option: ? > Usage: ./x11mirror-server [-p PORT] [OPTIONS] > Options: > -p PORT a port number to listen, default 8888 > -t CONNECTION_TIMEOUT a connection timeout in seconds, default 15 > sec. > -D enable MHD debug, disabled by default > -E enable epoll backend (Linux only) > -I MEMORY_INCEMENT increment to use for growing the read > buffer, default 4096 > -M MEMORY_LIMIT max memory size per connection, default 131072 > -T THREADS_NUM an amount of threads, default 1 > > > How do I test? > > 1. I am using curl as a HTTP client. > 2. You have to find a few files 5-20MB, with different names. Places > them into different directory, not there server binary lies. > 3. Write a bash file localtest.sh in the same directory where project > files lies. > > For instance, localtest.sh contents (lies in the same directory where > server binary is): > > #/bin/sh > > for i in $(seq 1 10); do > # clean files first > rm big1 big2 big3 > # upload > curl -F file=@test/big1 http://localhost:8888/ & > curl -F file=@test/big2 http://localhost:8888/ & > curl -F file=@test/big3 http://localhost:8888/ & > # sleep some time > sleep 1 > done > > Start a test: > > $ ./localtest.sh > > > Do not blame or bit for the code quality, the project is complete on > 5% only. Thanks :) > > === > > I am always forgot to say that after some recent changes you have to > update .gitignore file: > > $ git status > ... > Untracked files: > ... > po/POTFILES.in > po/aclocal.m4 > po/autom4te.cache/ > po/configure > po/configure.ac > src/include/microhttpd.h.orig > src/microhttpd/connection.c.orig > > Can't say that is annoying much because I don't have write permissions > to git anyway. Just to note. > > === > > About latest changes in git master, commit > de8217492bec2f08c985fd1a871fe2e6a5b753a6. > > 1. MHD_connection_update_event_loop_info() stills sends INTERNAL_ERROR > for a suspended connection. > 2. MHD_resume_connection() does not update connection->last_activity > > With the patch below I see that everything works as I expect (I may be > wrong, but...) > > > diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c > index 74238a1b..697c580d 100644 > --- a/src/microhttpd/connection.c > +++ b/src/microhttpd/connection.c > @@ -3217,6 +3217,11 @@ MHD_connection_handle_idle (struct > MHD_Connection *connection) > return MHD_YES; > } > } > + else > + { > + connection->in_idle = false; > + return MHD_YES; > + } > MHD_connection_update_event_loop_info (connection); > ret = MHD_YES; > #ifdef EPOLL_SUPPORT > diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c > index b78aabb0..e93f3dc8 100644 > --- a/src/microhttpd/daemon.c > +++ b/src/microhttpd/daemon.c > @@ -2793,6 +2793,7 @@ MHD_resume_connection (struct MHD_Connection > *connection) > MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); > connection->resuming = true; > daemon->resuming = true; > + connection->last_activity = MHD_monotonic_sec_counter(); > MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); > if ( (MHD_ITC_IS_VALID_(daemon->itc)) && > (! MHD_itc_activate_ (daemon->itc, "r")) ) > > > I hope it will help you. > > Thanks! > > -- > With Best Regards, > Vitaliy V. Tokarev > -- Silvio Clécio